Commit bcb42872 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

Computed property names for class literals in TurboFan.

R=dslomov@chromium.org
TEST=mjsunit/harmony/computed-property-names-classes

Review URL: https://codereview.chromium.org/861713004

Cr-Commit-Position: refs/heads/master@{#26165}
parent 006b5c5c
......@@ -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.
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment