aboutsummaryrefslogtreecommitdiff
path: root/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java')
-rw-r--r--src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java b/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java
index 934df7a6..7d61db1f 100644
--- a/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java
+++ b/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java
@@ -74,11 +74,6 @@ public final class ObjectClassGenerator {
static final int FIELD_PADDING = 4;
/**
- * Rounding when calculating the number of fields.
- */
- static final int FIELD_ROUNDING = 4;
-
- /**
* Debug field logger
* Should we print debugging information for fields when they are generated and getters/setters are called?
*/
@@ -325,7 +320,6 @@ public final class ObjectClassGenerator {
final List<String> initFields = addFields(classEmitter, fieldCount);
final MethodEmitter init = newInitMethod(classEmitter);
- initializeToUndefined(init, className, initFields);
init.returnVoid();
init.end();
@@ -709,6 +703,15 @@ public final class ObjectClassGenerator {
}
}
+ /**
+ * Add padding to field count to avoid creating too many classes and have some spare fields
+ * @param count the field count
+ * @return the padded field count
+ */
+ static int getPaddedFieldCount(final int count) {
+ return count / FIELD_PADDING * FIELD_PADDING + FIELD_PADDING;
+ }
+
//
// Provide generic getters and setters for undefined types. If a type is undefined, all
// and marshals the set to the correct setter depending on the type of the value being set.