| 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 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1411 case ObjectLiteral::Property::PROTOTYPE: | 1411 case ObjectLiteral::Property::PROTOTYPE: |
| 1412 PushOperand(Operand(rsp, 0)); // Duplicate receiver. | 1412 PushOperand(Operand(rsp, 0)); // Duplicate receiver. |
| 1413 VisitForStackValue(value); | 1413 VisitForStackValue(value); |
| 1414 DCHECK(property->emit_store()); | 1414 DCHECK(property->emit_store()); |
| 1415 CallRuntimeWithOperands(Runtime::kInternalSetPrototype); | 1415 CallRuntimeWithOperands(Runtime::kInternalSetPrototype); |
| 1416 PrepareForBailoutForId(expr->GetIdForPropertySet(property_index), | 1416 PrepareForBailoutForId(expr->GetIdForPropertySet(property_index), |
| 1417 BailoutState::NO_REGISTERS); | 1417 BailoutState::NO_REGISTERS); |
| 1418 break; | 1418 break; |
| 1419 case ObjectLiteral::Property::GETTER: | 1419 case ObjectLiteral::Property::GETTER: |
| 1420 if (property->emit_store()) { | 1420 if (property->emit_store()) { |
| 1421 accessor_table.lookup(key)->second->getter = property; | 1421 AccessorTable::Iterator it = accessor_table.lookup(key); |
| 1422 it->second->bailout_id = expr->GetIdForPropertySet(property_index); |
| 1423 it->second->getter = property; |
| 1422 } | 1424 } |
| 1423 break; | 1425 break; |
| 1424 case ObjectLiteral::Property::SETTER: | 1426 case ObjectLiteral::Property::SETTER: |
| 1425 if (property->emit_store()) { | 1427 if (property->emit_store()) { |
| 1426 accessor_table.lookup(key)->second->setter = property; | 1428 AccessorTable::Iterator it = accessor_table.lookup(key); |
| 1429 it->second->bailout_id = expr->GetIdForPropertySet(property_index); |
| 1430 it->second->setter = property; |
| 1427 } | 1431 } |
| 1428 break; | 1432 break; |
| 1429 } | 1433 } |
| 1430 } | 1434 } |
| 1431 | 1435 |
| 1432 // Emit code to define accessors, using only a single call to the runtime for | 1436 // Emit code to define accessors, using only a single call to the runtime for |
| 1433 // each pair of corresponding getters and setters. | 1437 // each pair of corresponding getters and setters. |
| 1434 for (AccessorTable::Iterator it = accessor_table.begin(); | 1438 for (AccessorTable::Iterator it = accessor_table.begin(); |
| 1435 it != accessor_table.end(); | 1439 it != accessor_table.end(); |
| 1436 ++it) { | 1440 ++it) { |
| 1437 PushOperand(Operand(rsp, 0)); // Duplicate receiver. | 1441 PushOperand(Operand(rsp, 0)); // Duplicate receiver. |
| 1438 VisitForStackValue(it->first); | 1442 VisitForStackValue(it->first); |
| 1439 EmitAccessor(it->second->getter); | 1443 EmitAccessor(it->second->getter); |
| 1440 EmitAccessor(it->second->setter); | 1444 EmitAccessor(it->second->setter); |
| 1441 PushOperand(Smi::FromInt(NONE)); | 1445 PushOperand(Smi::FromInt(NONE)); |
| 1442 CallRuntimeWithOperands(Runtime::kDefineAccessorPropertyUnchecked); | 1446 CallRuntimeWithOperands(Runtime::kDefineAccessorPropertyUnchecked); |
| 1447 PrepareForBailoutForId(it->second->bailout_id, BailoutState::NO_REGISTERS); |
| 1443 } | 1448 } |
| 1444 | 1449 |
| 1445 // Object literals have two parts. The "static" part on the left contains no | 1450 // Object literals have two parts. The "static" part on the left contains no |
| 1446 // computed property names, and so we can compute its map ahead of time; see | 1451 // computed property names, and so we can compute its map ahead of time; see |
| 1447 // runtime.cc::CreateObjectLiteralBoilerplate. The second "dynamic" part | 1452 // runtime.cc::CreateObjectLiteralBoilerplate. The second "dynamic" part |
| 1448 // starts with the first computed property name, and continues with all | 1453 // starts with the first computed property name, and continues with all |
| 1449 // properties to its right. All the code from above initializes the static | 1454 // properties to its right. All the code from above initializes the static |
| 1450 // component of the object literal, and arranges for the map of the result to | 1455 // component of the object literal, and arranges for the map of the result to |
| 1451 // reflect the static order in which the keys appear. For the dynamic | 1456 // reflect the static order in which the keys appear. For the dynamic |
| 1452 // properties, we compile them into a series of "SetOwnProperty" runtime | 1457 // properties, we compile them into a series of "SetOwnProperty" runtime |
| (...skipping 2205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3658 DCHECK_EQ( | 3663 DCHECK_EQ( |
| 3659 isolate->builtins()->OnStackReplacement()->entry(), | 3664 isolate->builtins()->OnStackReplacement()->entry(), |
| 3660 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3665 Assembler::target_address_at(call_target_address, unoptimized_code)); |
| 3661 return ON_STACK_REPLACEMENT; | 3666 return ON_STACK_REPLACEMENT; |
| 3662 } | 3667 } |
| 3663 | 3668 |
| 3664 } // namespace internal | 3669 } // namespace internal |
| 3665 } // namespace v8 | 3670 } // namespace v8 |
| 3666 | 3671 |
| 3667 #endif // V8_TARGET_ARCH_X64 | 3672 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |