| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 6 | 6 |
| 7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1421 case ObjectLiteral::Property::PROTOTYPE: | 1421 case ObjectLiteral::Property::PROTOTYPE: |
| 1422 PushOperand(Operand(rsp, 0)); // Duplicate receiver. | 1422 PushOperand(Operand(rsp, 0)); // Duplicate receiver. |
| 1423 VisitForStackValue(value); | 1423 VisitForStackValue(value); |
| 1424 DCHECK(property->emit_store()); | 1424 DCHECK(property->emit_store()); |
| 1425 CallRuntimeWithOperands(Runtime::kInternalSetPrototype); | 1425 CallRuntimeWithOperands(Runtime::kInternalSetPrototype); |
| 1426 PrepareForBailoutForId(expr->GetIdForPropertySet(property_index), | 1426 PrepareForBailoutForId(expr->GetIdForPropertySet(property_index), |
| 1427 BailoutState::NO_REGISTERS); | 1427 BailoutState::NO_REGISTERS); |
| 1428 break; | 1428 break; |
| 1429 case ObjectLiteral::Property::GETTER: | 1429 case ObjectLiteral::Property::GETTER: |
| 1430 if (property->emit_store()) { | 1430 if (property->emit_store()) { |
| 1431 accessor_table.lookup(key)->second->getter = property; | 1431 AccessorTable::Iterator it = accessor_table.lookup(key); |
| 1432 it->second->bailout_id = expr->GetIdForPropertySet(property_index); |
| 1433 it->second->getter = property; |
| 1432 } | 1434 } |
| 1433 break; | 1435 break; |
| 1434 case ObjectLiteral::Property::SETTER: | 1436 case ObjectLiteral::Property::SETTER: |
| 1435 if (property->emit_store()) { | 1437 if (property->emit_store()) { |
| 1436 accessor_table.lookup(key)->second->setter = property; | 1438 AccessorTable::Iterator it = accessor_table.lookup(key); |
| 1439 it->second->bailout_id = expr->GetIdForPropertySet(property_index); |
| 1440 it->second->setter = property; |
| 1437 } | 1441 } |
| 1438 break; | 1442 break; |
| 1439 } | 1443 } |
| 1440 } | 1444 } |
| 1441 | 1445 |
| 1442 // Emit code to define accessors, using only a single call to the runtime for | 1446 // Emit code to define accessors, using only a single call to the runtime for |
| 1443 // each pair of corresponding getters and setters. | 1447 // each pair of corresponding getters and setters. |
| 1444 for (AccessorTable::Iterator it = accessor_table.begin(); | 1448 for (AccessorTable::Iterator it = accessor_table.begin(); |
| 1445 it != accessor_table.end(); | 1449 it != accessor_table.end(); |
| 1446 ++it) { | 1450 ++it) { |
| 1447 PushOperand(Operand(rsp, 0)); // Duplicate receiver. | 1451 PushOperand(Operand(rsp, 0)); // Duplicate receiver. |
| 1448 VisitForStackValue(it->first); | 1452 VisitForStackValue(it->first); |
| 1449 EmitAccessor(it->second->getter); | 1453 EmitAccessor(it->second->getter); |
| 1450 EmitAccessor(it->second->setter); | 1454 EmitAccessor(it->second->setter); |
| 1451 PushOperand(Smi::FromInt(NONE)); | 1455 PushOperand(Smi::FromInt(NONE)); |
| 1452 CallRuntimeWithOperands(Runtime::kDefineAccessorPropertyUnchecked); | 1456 CallRuntimeWithOperands(Runtime::kDefineAccessorPropertyUnchecked); |
| 1457 PrepareForBailoutForId(it->second->bailout_id, BailoutState::NO_REGISTERS); |
| 1453 } | 1458 } |
| 1454 | 1459 |
| 1455 // Object literals have two parts. The "static" part on the left contains no | 1460 // Object literals have two parts. The "static" part on the left contains no |
| 1456 // computed property names, and so we can compute its map ahead of time; see | 1461 // computed property names, and so we can compute its map ahead of time; see |
| 1457 // runtime.cc::CreateObjectLiteralBoilerplate. The second "dynamic" part | 1462 // runtime.cc::CreateObjectLiteralBoilerplate. The second "dynamic" part |
| 1458 // starts with the first computed property name, and continues with all | 1463 // starts with the first computed property name, and continues with all |
| 1459 // properties to its right. All the code from above initializes the static | 1464 // properties to its right. All the code from above initializes the static |
| 1460 // component of the object literal, and arranges for the map of the result to | 1465 // component of the object literal, and arranges for the map of the result to |
| 1461 // reflect the static order in which the keys appear. For the dynamic | 1466 // reflect the static order in which the keys appear. For the dynamic |
| 1462 // properties, we compile them into a series of "SetOwnProperty" runtime | 1467 // properties, we compile them into a series of "SetOwnProperty" runtime |
| (...skipping 2220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3683 DCHECK_EQ( | 3688 DCHECK_EQ( |
| 3684 isolate->builtins()->OnStackReplacement()->entry(), | 3689 isolate->builtins()->OnStackReplacement()->entry(), |
| 3685 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3690 Assembler::target_address_at(call_target_address, unoptimized_code)); |
| 3686 return ON_STACK_REPLACEMENT; | 3691 return ON_STACK_REPLACEMENT; |
| 3687 } | 3692 } |
| 3688 | 3693 |
| 3689 } // namespace internal | 3694 } // namespace internal |
| 3690 } // namespace v8 | 3695 } // namespace v8 |
| 3691 | 3696 |
| 3692 #endif // V8_TARGET_ARCH_X64 | 3697 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |