Reviewers: rossberg,
Message:
PTAL
Description:
[strong] Refactor out separate strong runtime call for class objects
BUG=v8:3956
LOG=N
Please review this at https://codereview.chromium.org/1270393002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+17, -55 lines):
M src/compiler/ast-graph-builder.cc
M src/compiler/linkage.cc
M src/full-codegen/arm/full-codegen-arm.cc
M src/full-codegen/arm64/full-codegen-arm64.cc
M src/full-codegen/ia32/full-codegen-ia32.cc
M src/full-codegen/mips/full-codegen-mips.cc
M src/full-codegen/mips64/full-codegen-mips64.cc
M src/full-codegen/ppc/full-codegen-ppc.cc
M src/full-codegen/x64/full-codegen-x64.cc
M src/full-codegen/x87/full-codegen-x87.cc
M src/runtime/runtime.h
M src/runtime/runtime-classes.cc
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc
b/src/compiler/ast-graph-builder.cc
index
fa56f8ce0737133d766addd688400e3f4bb1c6dd..a9825cf40022b59790224aa19775d5b595b772ec
100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -1643,10 +1643,8 @@ void
AstGraphBuilder::VisitClassLiteralContents(ClassLiteral* expr) {
// freeze them in strong mode.
environment()->Pop(); // proto
environment()->Pop(); // literal
- const Operator* op = javascript()->CallRuntime(
- is_strong(language_mode()) ? Runtime::kFinalizeClassDefinitionStrong
- : Runtime::kFinalizeClassDefinition,
- 2);
+ const Operator* op =
+ javascript()->CallRuntime(Runtime::kFinalizeClassDefinition, 2);
literal = NewNode(op, literal, proto);
// Assign to class variable.
Index: src/compiler/linkage.cc
diff --git a/src/compiler/linkage.cc b/src/compiler/linkage.cc
index
bae73df9f499134f8f2514c339521e85920e3137..5421f4110f0645b2ffadd0b6f350910fc49b9f46
100644
--- a/src/compiler/linkage.cc
+++ b/src/compiler/linkage.cc
@@ -193,7 +193,6 @@ int Linkage::FrameStateInputCount(Runtime::FunctionId
function) {
case Runtime::kAllocateInTargetSpace:
case Runtime::kDateField:
case Runtime::kFinalizeClassDefinition: // TODO(conradw): Is it
safe?
- case Runtime::kFinalizeClassDefinitionStrong: // TODO(conradw): Is it
safe?
case Runtime::kDefineClassMethod: // TODO(jarin): Is it
safe?
case Runtime::kDefineGetterPropertyUnchecked: // TODO(jarin): Is it
safe?
case Runtime::kDefineSetterPropertyUnchecked: // TODO(jarin): Is it
safe?
Index: src/full-codegen/arm/full-codegen-arm.cc
diff --git a/src/full-codegen/arm/full-codegen-arm.cc
b/src/full-codegen/arm/full-codegen-arm.cc
index
4d9e794396d78ecc965a6fc0c10d9418cd2bb8a9..0e6d4c04edf5263e6116d87383b54ae4dee0f38a
100644
--- a/src/full-codegen/arm/full-codegen-arm.cc
+++ b/src/full-codegen/arm/full-codegen-arm.cc
@@ -2574,10 +2574,7 @@ void
FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit,
// Set both the prototype and constructor to have fast properties, and
also
// freeze them in strong mode.
- __ CallRuntime(is_strong(language_mode())
- ? Runtime::kFinalizeClassDefinitionStrong
- : Runtime::kFinalizeClassDefinition,
- 2);
+ __ CallRuntime(Runtime::kFinalizeClassDefinition, 2);
}
Index: src/full-codegen/arm64/full-codegen-arm64.cc
diff --git a/src/full-codegen/arm64/full-codegen-arm64.cc
b/src/full-codegen/arm64/full-codegen-arm64.cc
index
655790a10b3d4675f961f084ea9c82373f20e78a..678471d0c996747b5d3f806af1b57134a22b3d65
100644
--- a/src/full-codegen/arm64/full-codegen-arm64.cc
+++ b/src/full-codegen/arm64/full-codegen-arm64.cc
@@ -2270,10 +2270,7 @@ void
FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit,
// Set both the prototype and constructor to have fast properties, and
also
// freeze them in strong mode.
- __ CallRuntime(is_strong(language_mode())
- ? Runtime::kFinalizeClassDefinitionStrong
- : Runtime::kFinalizeClassDefinition,
- 2);
+ __ CallRuntime(Runtime::kFinalizeClassDefinition, 2);
}
Index: src/full-codegen/ia32/full-codegen-ia32.cc
diff --git a/src/full-codegen/ia32/full-codegen-ia32.cc
b/src/full-codegen/ia32/full-codegen-ia32.cc
index
80fb965d2c71ff00dd42d1e018a15979ebce537b..6c1ac09969f99a4b59893ce23b36882d9a830c0c
100644
--- a/src/full-codegen/ia32/full-codegen-ia32.cc
+++ b/src/full-codegen/ia32/full-codegen-ia32.cc
@@ -2486,10 +2486,7 @@ void
FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit,
// Set both the prototype and constructor to have fast properties, and
also
// freeze them in strong mode.
- __ CallRuntime(is_strong(language_mode())
- ? Runtime::kFinalizeClassDefinitionStrong
- : Runtime::kFinalizeClassDefinition,
- 2);
+ __ CallRuntime(Runtime::kFinalizeClassDefinition, 2);
}
Index: src/full-codegen/mips/full-codegen-mips.cc
diff --git a/src/full-codegen/mips/full-codegen-mips.cc
b/src/full-codegen/mips/full-codegen-mips.cc
index
977a71dbbfec54d5fa1f818005b3fec216a2de04..cef99aba65af9fd0582ecd1c9d38e28d64e5f00e
100644
--- a/src/full-codegen/mips/full-codegen-mips.cc
+++ b/src/full-codegen/mips/full-codegen-mips.cc
@@ -2565,10 +2565,7 @@ void
FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit,
// Set both the prototype and constructor to have fast properties, and
also
// freeze them in strong mode.
- __ CallRuntime(is_strong(language_mode())
- ? Runtime::kFinalizeClassDefinitionStrong
- : Runtime::kFinalizeClassDefinition,
- 2);
+ __ CallRuntime(Runtime::kFinalizeClassDefinition, 2);
}
Index: src/full-codegen/mips64/full-codegen-mips64.cc
diff --git a/src/full-codegen/mips64/full-codegen-mips64.cc
b/src/full-codegen/mips64/full-codegen-mips64.cc
index
6014347fc783ee6c021eaa065b510cb43942b666..8075822fe5c83f42e5620d90055848659aaee843
100644
--- a/src/full-codegen/mips64/full-codegen-mips64.cc
+++ b/src/full-codegen/mips64/full-codegen-mips64.cc
@@ -2563,10 +2563,7 @@ void
FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit,
// Set both the prototype and constructor to have fast properties, and
also
// freeze them in strong mode.
- __ CallRuntime(is_strong(language_mode())
- ? Runtime::kFinalizeClassDefinitionStrong
- : Runtime::kFinalizeClassDefinition,
- 2);
+ __ CallRuntime(Runtime::kFinalizeClassDefinition, 2);
}
Index: src/full-codegen/ppc/full-codegen-ppc.cc
diff --git a/src/full-codegen/ppc/full-codegen-ppc.cc
b/src/full-codegen/ppc/full-codegen-ppc.cc
index
6ddf6c6a02c8fa42293c5ec239a824346c515b65..e20f36719af48f4b565017b14ff5f53313900bbd
100644
--- a/src/full-codegen/ppc/full-codegen-ppc.cc
+++ b/src/full-codegen/ppc/full-codegen-ppc.cc
@@ -2575,10 +2575,7 @@ void
FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit,
// Set both the prototype and constructor to have fast properties, and
also
// freeze them in strong mode.
- __ CallRuntime(is_strong(language_mode())
- ? Runtime::kFinalizeClassDefinitionStrong
- : Runtime::kFinalizeClassDefinition,
- 2);
+ __ CallRuntime(Runtime::kFinalizeClassDefinition, 2);
}
Index: src/full-codegen/x64/full-codegen-x64.cc
diff --git a/src/full-codegen/x64/full-codegen-x64.cc
b/src/full-codegen/x64/full-codegen-x64.cc
index
1eae31d522ea141075511c57b331f8ce85669629..65c0456dc70c32da4a18bfa18f326be43ec30a2c
100644
--- a/src/full-codegen/x64/full-codegen-x64.cc
+++ b/src/full-codegen/x64/full-codegen-x64.cc
@@ -2481,10 +2481,7 @@ void
FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit,
// Set both the prototype and constructor to have fast properties, and
also
// freeze them in strong mode.
- __ CallRuntime(is_strong(language_mode())
- ? Runtime::kFinalizeClassDefinitionStrong
- : Runtime::kFinalizeClassDefinition,
- 2);
+ __ CallRuntime(Runtime::kFinalizeClassDefinition, 2);
}
Index: src/full-codegen/x87/full-codegen-x87.cc
diff --git a/src/full-codegen/x87/full-codegen-x87.cc
b/src/full-codegen/x87/full-codegen-x87.cc
index
12d24c0e859c8d54ddaa86a5e24b7d015f3122e1..f1848c9e06167bdb161a90ec389005d31998680c
100644
--- a/src/full-codegen/x87/full-codegen-x87.cc
+++ b/src/full-codegen/x87/full-codegen-x87.cc
@@ -2477,10 +2477,7 @@ void
FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit,
// Set both the prototype and constructor to have fast properties, and
also
// freeze them in strong mode.
- __ CallRuntime(is_strong(language_mode())
- ? Runtime::kFinalizeClassDefinitionStrong
- : Runtime::kFinalizeClassDefinition,
- 2);
+ __ CallRuntime(Runtime::kFinalizeClassDefinition, 2);
}
Index: src/runtime/runtime-classes.cc
diff --git a/src/runtime/runtime-classes.cc b/src/runtime/runtime-classes.cc
index
76c5c0068da4764a4bae6e81286184187a7ca2bc..bfd949a4522be0f7ead20c54af8e727a06416393
100644
--- a/src/runtime/runtime-classes.cc
+++ b/src/runtime/runtime-classes.cc
@@ -262,27 +262,17 @@ RUNTIME_FUNCTION(Runtime_FinalizeClassDefinition) {
JSObject::MigrateSlowToFast(prototype, 0, "RuntimeToFastProperties");
JSObject::MigrateSlowToFast(constructor, 0, "RuntimeToFastProperties");
+ if (constructor->map()->is_strong()) {
+ RETURN_FAILURE_ON_EXCEPTION(isolate, JSObject::Freeze(prototype));
+ Handle<Object> result;
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
+ JSObject::Freeze(constructor));
+ return *result;
+ }
return *constructor;
}
-RUNTIME_FUNCTION(Runtime_FinalizeClassDefinitionStrong) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 2);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, constructor, 0);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, prototype, 1);
-
- JSObject::MigrateSlowToFast(prototype, 0, "RuntimeToFastProperties");
- JSObject::MigrateSlowToFast(constructor, 0, "RuntimeToFastProperties");
-
- RETURN_FAILURE_ON_EXCEPTION(isolate, JSObject::Freeze(prototype));
- Handle<Object> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
- JSObject::Freeze(constructor));
- return *result;
-}
-
-
RUNTIME_FUNCTION(Runtime_ClassGetSourceCode) {
HandleScope shs(isolate);
DCHECK(args.length() == 1);
Index: src/runtime/runtime.h
diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h
index
21f38e5dba52210bddf2652e2a3de0c45f9193c4..28292a07e9698ef7ef87b57953942691fdbcf81a
100644
--- a/src/runtime/runtime.h
+++ b/src/runtime/runtime.h
@@ -85,7 +85,6 @@ namespace internal {
F(DefineClass, 6, 1) \
F(DefineClassStrong, 6, 1) \
F(FinalizeClassDefinition, 2, 1) \
- F(FinalizeClassDefinitionStrong, 2, 1) \
F(DefineClassMethod, 3, 1) \
F(ClassGetSourceCode, 1, 1) \
F(LoadFromSuper, 4, 1) \
--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.