| OLD | NEW | 
|---|
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "src/compiler/ast-graph-builder.h" | 5 #include "src/compiler/ast-graph-builder.h" | 
| 6 | 6 | 
| 7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" | 
| 8 #include "src/compiler.h" | 8 #include "src/compiler.h" | 
| 9 #include "src/compiler/ast-loop-assignment-analyzer.h" | 9 #include "src/compiler/ast-loop-assignment-analyzer.h" | 
| 10 #include "src/compiler/control-builders.h" | 10 #include "src/compiler/control-builders.h" | 
| (...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1575 | 1575 | 
| 1576   // Create node to instantiate a new class. | 1576   // Create node to instantiate a new class. | 
| 1577   Node* constructor = environment()->Pop(); | 1577   Node* constructor = environment()->Pop(); | 
| 1578   Node* extends = environment()->Pop(); | 1578   Node* extends = environment()->Pop(); | 
| 1579   Node* start = jsgraph()->Constant(expr->start_position()); | 1579   Node* start = jsgraph()->Constant(expr->start_position()); | 
| 1580   Node* end = jsgraph()->Constant(expr->end_position()); | 1580   Node* end = jsgraph()->Constant(expr->end_position()); | 
| 1581   const Operator* opc = javascript()->CallRuntime(Runtime::kDefineClass); | 1581   const Operator* opc = javascript()->CallRuntime(Runtime::kDefineClass); | 
| 1582   Node* literal = NewNode(opc, extends, constructor, start, end); | 1582   Node* literal = NewNode(opc, extends, constructor, start, end); | 
| 1583   PrepareFrameState(literal, expr->CreateLiteralId(), | 1583   PrepareFrameState(literal, expr->CreateLiteralId(), | 
| 1584                     OutputFrameStateCombine::Push()); | 1584                     OutputFrameStateCombine::Push()); | 
|  | 1585   environment()->Push(literal); | 
| 1585 | 1586 | 
| 1586   // The prototype is ensured to exist by Runtime_DefineClass. No access check | 1587   // Load the "prototype" from the constructor. | 
| 1587   // is needed here since the constructor is created by the class literal. | 1588   FrameStateBeforeAndAfter states(this, expr->CreateLiteralId()); | 
| 1588   Node* prototype = | 1589   Handle<Name> name = isolate()->factory()->prototype_string(); | 
| 1589       BuildLoadObjectField(literal, JSFunction::kPrototypeOrInitialMapOffset); | 1590   VectorSlotPair pair = CreateVectorSlotPair(expr->PrototypeSlot()); | 
| 1590 | 1591   Node* prototype = BuildNamedLoad(literal, name, pair); | 
| 1591   // The class literal and the prototype are both expected on the operand stack | 1592   states.AddToNode(prototype, expr->PrototypeId(), | 
| 1592   // during evaluation of the method values. | 1593                    OutputFrameStateCombine::Push()); | 
| 1593   environment()->Push(literal); |  | 
| 1594   environment()->Push(prototype); | 1594   environment()->Push(prototype); | 
| 1595 | 1595 | 
| 1596   // Create nodes to store method values into the literal. | 1596   // Create nodes to store method values into the literal. | 
| 1597   for (int i = 0; i < expr->properties()->length(); i++) { | 1597   for (int i = 0; i < expr->properties()->length(); i++) { | 
| 1598     ObjectLiteral::Property* property = expr->properties()->at(i); | 1598     ObjectLiteral::Property* property = expr->properties()->at(i); | 
| 1599     environment()->Push(environment()->Peek(property->is_static() ? 1 : 0)); | 1599     environment()->Push(environment()->Peek(property->is_static() ? 1 : 0)); | 
| 1600 | 1600 | 
| 1601     VisitForValue(property->key()); | 1601     VisitForValue(property->key()); | 
| 1602     Node* name = BuildToName(environment()->Pop(), expr->GetIdForProperty(i)); | 1602     Node* name = BuildToName(environment()->Pop(), expr->GetIdForProperty(i)); | 
| 1603     environment()->Push(name); | 1603     environment()->Push(name); | 
| (...skipping 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3664 | 3664 | 
| 3665 Node* AstGraphBuilder::BuildGlobalStore(Handle<Name> name, Node* value, | 3665 Node* AstGraphBuilder::BuildGlobalStore(Handle<Name> name, Node* value, | 
| 3666                                         const VectorSlotPair& feedback) { | 3666                                         const VectorSlotPair& feedback) { | 
| 3667   const Operator* op = | 3667   const Operator* op = | 
| 3668       javascript()->StoreGlobal(language_mode(), name, feedback); | 3668       javascript()->StoreGlobal(language_mode(), name, feedback); | 
| 3669   Node* node = NewNode(op, value, BuildLoadFeedbackVector()); | 3669   Node* node = NewNode(op, value, BuildLoadFeedbackVector()); | 
| 3670   return node; | 3670   return node; | 
| 3671 } | 3671 } | 
| 3672 | 3672 | 
| 3673 | 3673 | 
| 3674 Node* AstGraphBuilder::BuildLoadObjectField(Node* object, int offset) { |  | 
| 3675   return NewNode(jsgraph()->machine()->Load(MachineType::AnyTagged()), object, |  | 
| 3676                  jsgraph()->IntPtrConstant(offset - kHeapObjectTag)); |  | 
| 3677 } |  | 
| 3678 |  | 
| 3679 |  | 
| 3680 Node* AstGraphBuilder::BuildLoadImmutableObjectField(Node* object, int offset) { | 3674 Node* AstGraphBuilder::BuildLoadImmutableObjectField(Node* object, int offset) { | 
| 3681   return graph()->NewNode(jsgraph()->machine()->Load(MachineType::AnyTagged()), | 3675   return graph()->NewNode(jsgraph()->machine()->Load(MachineType::AnyTagged()), | 
| 3682                           object, | 3676                           object, | 
| 3683                           jsgraph()->IntPtrConstant(offset - kHeapObjectTag), | 3677                           jsgraph()->IntPtrConstant(offset - kHeapObjectTag), | 
| 3684                           graph()->start(), graph()->start()); | 3678                           graph()->start(), graph()->start()); | 
| 3685 } | 3679 } | 
| 3686 | 3680 | 
| 3687 | 3681 | 
| 3688 Node* AstGraphBuilder::BuildLoadGlobalObject() { | 3682 Node* AstGraphBuilder::BuildLoadGlobalObject() { | 
| 3689   return BuildLoadNativeContextField(Context::EXTENSION_INDEX); | 3683   return BuildLoadNativeContextField(Context::EXTENSION_INDEX); | 
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4361     // Phi does not exist yet, introduce one. | 4355     // Phi does not exist yet, introduce one. | 
| 4362     value = NewPhi(inputs, value, control); | 4356     value = NewPhi(inputs, value, control); | 
| 4363     value->ReplaceInput(inputs - 1, other); | 4357     value->ReplaceInput(inputs - 1, other); | 
| 4364   } | 4358   } | 
| 4365   return value; | 4359   return value; | 
| 4366 } | 4360 } | 
| 4367 | 4361 | 
| 4368 }  // namespace compiler | 4362 }  // namespace compiler | 
| 4369 }  // namespace internal | 4363 }  // namespace internal | 
| 4370 }  // namespace v8 | 4364 }  // namespace v8 | 
| OLD | NEW | 
|---|