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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1648 // Mark all computed expressions that are bound to a key that | 1648 // Mark all computed expressions that are bound to a key that |
1649 // is shadowed by a later occurrence of the same key. For the | 1649 // is shadowed by a later occurrence of the same key. For the |
1650 // marked expressions, no store code is emitted. | 1650 // marked expressions, no store code is emitted. |
1651 expr->CalculateEmitStore(zone()); | 1651 expr->CalculateEmitStore(zone()); |
1652 | 1652 |
1653 AccessorTable accessor_table(zone()); | 1653 AccessorTable accessor_table(zone()); |
1654 for (int i = 0; i < expr->properties()->length(); i++) { | 1654 for (int i = 0; i < expr->properties()->length(); i++) { |
1655 ObjectLiteral::Property* property = expr->properties()->at(i); | 1655 ObjectLiteral::Property* property = expr->properties()->at(i); |
1656 if (property->IsCompileTimeValue()) continue; | 1656 if (property->IsCompileTimeValue()) continue; |
1657 | 1657 |
1658 Literal* key = property->key(); | 1658 Literal* key = property->key()->AsLiteral(); |
1659 Expression* value = property->value(); | 1659 Expression* value = property->value(); |
1660 if (!result_saved) { | 1660 if (!result_saved) { |
1661 __ Push(rax); // Save result on the stack | 1661 __ Push(rax); // Save result on the stack |
1662 result_saved = true; | 1662 result_saved = true; |
1663 } | 1663 } |
1664 switch (property->kind()) { | 1664 switch (property->kind()) { |
1665 case ObjectLiteral::Property::CONSTANT: | 1665 case ObjectLiteral::Property::CONSTANT: |
1666 UNREACHABLE(); | 1666 UNREACHABLE(); |
1667 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 1667 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
1668 DCHECK(!CompileTimeValue::IsCompileTimeValue(value)); | 1668 DCHECK(!CompileTimeValue::IsCompileTimeValue(value)); |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2395 ObjectLiteral::Property* property = lit->properties()->at(i); | 2395 ObjectLiteral::Property* property = lit->properties()->at(i); |
2396 Literal* key = property->key()->AsLiteral(); | 2396 Literal* key = property->key()->AsLiteral(); |
2397 Expression* value = property->value(); | 2397 Expression* value = property->value(); |
2398 DCHECK(key != NULL); | 2398 DCHECK(key != NULL); |
2399 | 2399 |
2400 if (property->is_static()) { | 2400 if (property->is_static()) { |
2401 __ Push(Operand(rsp, kPointerSize)); // constructor | 2401 __ Push(Operand(rsp, kPointerSize)); // constructor |
2402 } else { | 2402 } else { |
2403 __ Push(Operand(rsp, 0)); // prototype | 2403 __ Push(Operand(rsp, 0)); // prototype |
2404 } | 2404 } |
2405 VisitForStackValue(key); | 2405 EmitPropertyKey(property); |
2406 VisitForStackValue(value); | 2406 VisitForStackValue(value); |
2407 EmitSetHomeObjectIfNeeded(value, 2); | 2407 EmitSetHomeObjectIfNeeded(value, 2); |
2408 | 2408 |
2409 switch (property->kind()) { | 2409 switch (property->kind()) { |
2410 case ObjectLiteral::Property::CONSTANT: | 2410 case ObjectLiteral::Property::CONSTANT: |
2411 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 2411 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
2412 case ObjectLiteral::Property::COMPUTED: | 2412 case ObjectLiteral::Property::COMPUTED: |
2413 case ObjectLiteral::Property::PROTOTYPE: | 2413 case ObjectLiteral::Property::PROTOTYPE: |
2414 __ CallRuntime(Runtime::kDefineClassMethod, 3); | 2414 __ CallRuntime(Runtime::kDefineClassMethod, 3); |
2415 break; | 2415 break; |
2416 | 2416 |
2417 case ObjectLiteral::Property::GETTER: | 2417 case ObjectLiteral::Property::GETTER: |
2418 __ CallRuntime(Runtime::kDefineClassGetter, 3); | 2418 __ CallRuntime(Runtime::kDefineGetterPropertyUnchecked, 3); |
2419 break; | 2419 break; |
2420 | 2420 |
2421 case ObjectLiteral::Property::SETTER: | 2421 case ObjectLiteral::Property::SETTER: |
2422 __ CallRuntime(Runtime::kDefineClassSetter, 3); | 2422 __ CallRuntime(Runtime::kDefineSetterPropertyUnchecked, 3); |
2423 break; | 2423 break; |
2424 | 2424 |
2425 default: | 2425 default: |
2426 UNREACHABLE(); | 2426 UNREACHABLE(); |
2427 } | 2427 } |
2428 } | 2428 } |
2429 | 2429 |
2430 // prototype | 2430 // prototype |
2431 __ CallRuntime(Runtime::kToFastProperties, 1); | 2431 __ CallRuntime(Runtime::kToFastProperties, 1); |
2432 | 2432 |
(...skipping 2760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5193 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5193 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
5194 Assembler::target_address_at(call_target_address, | 5194 Assembler::target_address_at(call_target_address, |
5195 unoptimized_code)); | 5195 unoptimized_code)); |
5196 return OSR_AFTER_STACK_CHECK; | 5196 return OSR_AFTER_STACK_CHECK; |
5197 } | 5197 } |
5198 | 5198 |
5199 | 5199 |
5200 } } // namespace v8::internal | 5200 } } // namespace v8::internal |
5201 | 5201 |
5202 #endif // V8_TARGET_ARCH_X64 | 5202 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |