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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/ast/compile-time-value.h" | 7 #include "src/ast/compile-time-value.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/builtins/builtins-constructor.h" | 9 #include "src/builtins/builtins-constructor.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1097 int offset = property->kind() == ObjectLiteral::Property::GETTER ? 2 : 3; | 1097 int offset = property->kind() == ObjectLiteral::Property::GETTER ? 2 : 3; |
1098 EmitSetHomeObject(expression, offset, property->GetSlot()); | 1098 EmitSetHomeObject(expression, offset, property->GetSlot()); |
1099 } | 1099 } |
1100 } | 1100 } |
1101 } | 1101 } |
1102 | 1102 |
1103 | 1103 |
1104 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { | 1104 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
1105 Comment cmnt(masm_, "[ ObjectLiteral"); | 1105 Comment cmnt(masm_, "[ ObjectLiteral"); |
1106 | 1106 |
1107 Handle<FixedArray> constant_properties = expr->constant_properties(); | 1107 Handle<FixedArray> constant_properties = |
| 1108 expr->GetOrBuildConstantProperties(isolate()); |
1108 int flags = expr->ComputeFlags(); | 1109 int flags = expr->ComputeFlags(); |
1109 // If any of the keys would store to the elements array, then we shouldn't | 1110 // If any of the keys would store to the elements array, then we shouldn't |
1110 // allow it. | 1111 // allow it. |
1111 if (MustCreateObjectLiteralWithRuntime(expr)) { | 1112 if (MustCreateObjectLiteralWithRuntime(expr)) { |
1112 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 1113 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
1113 __ push(Immediate(Smi::FromInt(expr->literal_index()))); | 1114 __ push(Immediate(Smi::FromInt(expr->literal_index()))); |
1114 __ push(Immediate(constant_properties)); | 1115 __ push(Immediate(constant_properties)); |
1115 __ push(Immediate(Smi::FromInt(flags))); | 1116 __ push(Immediate(Smi::FromInt(flags))); |
1116 __ CallRuntime(Runtime::kCreateObjectLiteral); | 1117 __ CallRuntime(Runtime::kCreateObjectLiteral); |
1117 } else { | 1118 } else { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 context()->PlugTOS(); | 1227 context()->PlugTOS(); |
1227 } else { | 1228 } else { |
1228 context()->Plug(eax); | 1229 context()->Plug(eax); |
1229 } | 1230 } |
1230 } | 1231 } |
1231 | 1232 |
1232 | 1233 |
1233 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { | 1234 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { |
1234 Comment cmnt(masm_, "[ ArrayLiteral"); | 1235 Comment cmnt(masm_, "[ ArrayLiteral"); |
1235 | 1236 |
1236 Handle<ConstantElementsPair> constant_elements = expr->constant_elements(); | 1237 Handle<ConstantElementsPair> constant_elements = |
| 1238 expr->GetOrBuildConstantElements(isolate()); |
1237 bool has_constant_fast_elements = | 1239 bool has_constant_fast_elements = |
1238 IsFastObjectElementsKind(expr->constant_elements_kind()); | 1240 IsFastObjectElementsKind(expr->constant_elements_kind()); |
1239 | 1241 |
1240 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; | 1242 AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE; |
1241 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { | 1243 if (has_constant_fast_elements && !FLAG_allocation_site_pretenuring) { |
1242 // If the only customer of allocation sites is transitioning, then | 1244 // If the only customer of allocation sites is transitioning, then |
1243 // we can turn it off if we don't have anywhere else to transition to. | 1245 // we can turn it off if we don't have anywhere else to transition to. |
1244 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; | 1246 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
1245 } | 1247 } |
1246 | 1248 |
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2704 isolate->builtins()->OnStackReplacement()->entry(), | 2706 isolate->builtins()->OnStackReplacement()->entry(), |
2705 Assembler::target_address_at(call_target_address, unoptimized_code)); | 2707 Assembler::target_address_at(call_target_address, unoptimized_code)); |
2706 return ON_STACK_REPLACEMENT; | 2708 return ON_STACK_REPLACEMENT; |
2707 } | 2709 } |
2708 | 2710 |
2709 | 2711 |
2710 } // namespace internal | 2712 } // namespace internal |
2711 } // namespace v8 | 2713 } // namespace v8 |
2712 | 2714 |
2713 #endif // V8_TARGET_ARCH_IA32 | 2715 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |