Reviewers: Dmitry Lomov (chromium),
Description:
Computed property names for class literals in TurboFan.
[email protected]
TEST=mjsunit/harmony/computed-property-names-classes
Please review this at https://codereview.chromium.org/861713004/
Base URL:
https://chromium.googlesource.com/v8/v8.git@local_cleanup-compiler-8
Affected files (+16, -3 lines):
M src/compiler/ast-graph-builder.h
M src/compiler/ast-graph-builder.cc
M src/compiler/js-generic-lowering.cc
M test/mjsunit/mjsunit.status
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc
b/src/compiler/ast-graph-builder.cc
index
3acb57acb25b3072767584a3499d13ffcec299dd..8443cfafac50cf6aff02651acfb4aa55e51fc24e
100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -897,6 +897,7 @@ void
AstGraphBuilder::VisitClassLiteralContents(ClassLiteral* expr) {
environment()->Push(property->is_static() ? literal : proto);
VisitForValue(property->key());
+ environment()->Push(BuildToName(environment()->Pop()));
VisitForValue(property->value());
Node* value = environment()->Pop();
Node* key = environment()->Pop();
@@ -2232,7 +2233,7 @@ Node* AstGraphBuilder::BuildLoadGlobalProxy() {
Node* AstGraphBuilder::BuildToBoolean(Node* input) {
- // TODO(titzer): this should be in a JSOperatorReducer.
+ // TODO(titzer): This should be in a JSOperatorReducer.
switch (input->opcode()) {
case IrOpcode::kInt32Constant:
return jsgraph_->BooleanConstant(!Int32Matcher(input).Is(0));
@@ -2256,6 +2257,14 @@ Node* AstGraphBuilder::BuildToBoolean(Node* input) {
}
+Node* AstGraphBuilder::BuildToName(Node* input) {
+ // TODO(turbofan): Possible optimization is to NOP on name constants.
But the
+ // same caveat as with BuildToBoolean applies, and it should be factored
out
+ // into a JSOperatorReducer.
+ return NewNode(javascript()->ToName(), input);
+}
+
+
Node* AstGraphBuilder::BuildThrowReferenceError(Variable* variable,
BailoutId bailout_id) {
// TODO(mstarzinger): Should be unified with the VisitThrow
implementation.
Index: src/compiler/ast-graph-builder.h
diff --git a/src/compiler/ast-graph-builder.h
b/src/compiler/ast-graph-builder.h
index
8493d42b0378da817fd40fb464fc13ebbbf17dcc..98d7fb63049b3d79415f3297775ff61edd2f94a7
100644
--- a/src/compiler/ast-graph-builder.h
+++ b/src/compiler/ast-graph-builder.h
@@ -99,6 +99,7 @@ class AstGraphBuilder : public StructuredGraphBuilder,
public AstVisitor {
// Builders for automatic type conversion.
Node* BuildToBoolean(Node* value);
+ Node* BuildToName(Node* value);
// Builders for error reporting at runtime.
Node* BuildThrowReferenceError(Variable* var, BailoutId bailout_id);
Index: src/compiler/js-generic-lowering.cc
diff --git a/src/compiler/js-generic-lowering.cc
b/src/compiler/js-generic-lowering.cc
index
48864423146007ec632915d4ac1ad0658ca80c93..05f4aa89eb5e01e91190dca3cdbd4f78afed099c
100644
--- a/src/compiler/js-generic-lowering.cc
+++ b/src/compiler/js-generic-lowering.cc
@@ -111,7 +111,6 @@ REPLACE_RUNTIME_CALL(JSCreateScriptContext,
Runtime::kAbort)
#define REPLACE_UNIMPLEMENTED(op) \
void JSGenericLowering::Lower##op(Node* node) { UNIMPLEMENTED(); }
-REPLACE_UNIMPLEMENTED(JSToName)
REPLACE_UNIMPLEMENTED(JSYield)
REPLACE_UNIMPLEMENTED(JSDebugger)
#undef REPLACE_UNIMPLEMENTED
@@ -241,6 +240,11 @@ void JSGenericLowering::LowerJSToString(Node* node) {
}
+void JSGenericLowering::LowerJSToName(Node* node) {
+ ReplaceWithBuiltinCall(node, Builtins::TO_NAME, 1);
+}
+
+
void JSGenericLowering::LowerJSToObject(Node* node) {
ReplaceWithBuiltinCall(node, Builtins::TO_OBJECT, 1);
}
Index: test/mjsunit/mjsunit.status
diff --git a/test/mjsunit/mjsunit.status b/test/mjsunit/mjsunit.status
index
dc14dc361c996f2bc40c190d43a030deff5a3582..86632b7789b8317fdc844eb44ed6d650b7ef8c40
100644
--- a/test/mjsunit/mjsunit.status
+++ b/test/mjsunit/mjsunit.status
@@ -87,7 +87,6 @@
# TODO(mstarzinger): Investigate failures with computed property names.
# Note that this happens in GC-stress mode only.
'harmony/computed-property-names': [PASS, NO_VARIANTS],
- 'harmony/computed-property-names-classes': [PASS, NO_VARIANTS],
'harmony/computed-property-names-object-literals-methods': [PASS,
NO_VARIANTS],
# TODO(jarin/mstarzinger): Investigate debugger issues with TurboFan.
--
--
v8-dev mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.