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_X87 | 5 #if V8_TARGET_ARCH_X87 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 __ jmp(done); | 1302 __ jmp(done); |
1303 } | 1303 } |
1304 } | 1304 } |
1305 | 1305 |
1306 | 1306 |
1307 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, | 1307 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, |
1308 TypeofMode typeof_mode) { | 1308 TypeofMode typeof_mode) { |
1309 Variable* var = proxy->var(); | 1309 Variable* var = proxy->var(); |
1310 DCHECK(var->IsUnallocatedOrGlobalSlot() || | 1310 DCHECK(var->IsUnallocatedOrGlobalSlot() || |
1311 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); | 1311 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); |
1312 if (var->IsGlobalSlot()) { | 1312 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
1313 DCHECK(var->index() > 0); | 1313 __ mov(LoadDescriptor::NameRegister(), var->name()); |
1314 DCHECK(var->IsStaticGlobalObjectProperty()); | 1314 __ mov(LoadDescriptor::SlotRegister(), |
1315 int const slot = var->index(); | 1315 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
1316 int const depth = scope()->ContextChainLength(var->scope()); | 1316 CallLoadIC(typeof_mode); |
1317 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { | |
1318 __ Move(LoadGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); | |
1319 LoadGlobalViaContextStub stub(isolate(), depth); | |
1320 __ CallStub(&stub); | |
1321 } else { | |
1322 __ Push(Smi::FromInt(slot)); | |
1323 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); | |
1324 } | |
1325 | |
1326 } else { | |
1327 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | |
1328 __ mov(LoadDescriptor::NameRegister(), var->name()); | |
1329 __ mov(LoadDescriptor::SlotRegister(), | |
1330 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot()))); | |
1331 CallLoadIC(typeof_mode); | |
1332 } | |
1333 } | 1317 } |
1334 | 1318 |
1335 | 1319 |
1336 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, | 1320 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, |
1337 TypeofMode typeof_mode) { | 1321 TypeofMode typeof_mode) { |
1338 SetExpressionPosition(proxy); | 1322 SetExpressionPosition(proxy); |
1339 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); | 1323 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); |
1340 Variable* var = proxy->var(); | 1324 Variable* var = proxy->var(); |
1341 | 1325 |
1342 // Three cases: global variables, lookup variables, and all other types of | 1326 // Three cases: global variables, lookup variables, and all other types of |
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2498 | 2482 |
2499 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, | 2483 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, |
2500 FeedbackVectorSlot slot) { | 2484 FeedbackVectorSlot slot) { |
2501 if (var->IsUnallocated()) { | 2485 if (var->IsUnallocated()) { |
2502 // Global var, const, or let. | 2486 // Global var, const, or let. |
2503 __ mov(StoreDescriptor::NameRegister(), var->name()); | 2487 __ mov(StoreDescriptor::NameRegister(), var->name()); |
2504 __ mov(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 2488 __ mov(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
2505 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); | 2489 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
2506 CallStoreIC(); | 2490 CallStoreIC(); |
2507 | 2491 |
2508 } else if (var->IsGlobalSlot()) { | |
2509 // Global var, const, or let. | |
2510 DCHECK(var->index() > 0); | |
2511 DCHECK(var->IsStaticGlobalObjectProperty()); | |
2512 int const slot = var->index(); | |
2513 int const depth = scope()->ContextChainLength(var->scope()); | |
2514 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { | |
2515 __ Move(StoreGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); | |
2516 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(eax)); | |
2517 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); | |
2518 __ CallStub(&stub); | |
2519 } else { | |
2520 __ Push(Smi::FromInt(slot)); | |
2521 __ Push(eax); | |
2522 __ CallRuntime(is_strict(language_mode()) | |
2523 ? Runtime::kStoreGlobalViaContext_Strict | |
2524 : Runtime::kStoreGlobalViaContext_Sloppy, | |
2525 2); | |
2526 } | |
2527 | |
2528 } else if (var->mode() == LET && op != Token::INIT_LET) { | 2492 } else if (var->mode() == LET && op != Token::INIT_LET) { |
2529 // Non-initializing assignment to let variable needs a write barrier. | 2493 // Non-initializing assignment to let variable needs a write barrier. |
2530 DCHECK(!var->IsLookupSlot()); | 2494 DCHECK(!var->IsLookupSlot()); |
2531 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2495 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
2532 Label assign; | 2496 Label assign; |
2533 MemOperand location = VarOperand(var, ecx); | 2497 MemOperand location = VarOperand(var, ecx); |
2534 __ mov(edx, location); | 2498 __ mov(edx, location); |
2535 __ cmp(edx, isolate()->factory()->the_hole_value()); | 2499 __ cmp(edx, isolate()->factory()->the_hole_value()); |
2536 __ j(not_equal, &assign, Label::kNear); | 2500 __ j(not_equal, &assign, Label::kNear); |
2537 __ push(Immediate(var->name())); | 2501 __ push(Immediate(var->name())); |
(...skipping 2539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5077 Assembler::target_address_at(call_target_address, | 5041 Assembler::target_address_at(call_target_address, |
5078 unoptimized_code)); | 5042 unoptimized_code)); |
5079 return OSR_AFTER_STACK_CHECK; | 5043 return OSR_AFTER_STACK_CHECK; |
5080 } | 5044 } |
5081 | 5045 |
5082 | 5046 |
5083 } // namespace internal | 5047 } // namespace internal |
5084 } // namespace v8 | 5048 } // namespace v8 |
5085 | 5049 |
5086 #endif // V8_TARGET_ARCH_X87 | 5050 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |