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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
8 | 8 |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 context()->Plug(eax); | 1280 context()->Plug(eax); |
1281 } | 1281 } |
1282 | 1282 |
1283 | 1283 |
1284 void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { | 1284 void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { |
1285 Comment cmnt(masm_, "[ VariableProxy"); | 1285 Comment cmnt(masm_, "[ VariableProxy"); |
1286 EmitVariableLoad(expr); | 1286 EmitVariableLoad(expr); |
1287 } | 1287 } |
1288 | 1288 |
1289 | 1289 |
1290 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var, | 1290 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, |
1291 TypeofState typeof_state, | 1291 TypeofState typeof_state, |
1292 Label* slow) { | 1292 Label* slow) { |
1293 Register context = esi; | 1293 Register context = esi; |
1294 Register temp = edx; | 1294 Register temp = edx; |
1295 | 1295 |
1296 Scope* s = scope(); | 1296 Scope* s = scope(); |
1297 while (s != NULL) { | 1297 while (s != NULL) { |
1298 if (s->num_heap_slots() > 0) { | 1298 if (s->num_heap_slots() > 0) { |
1299 if (s->calls_sloppy_eval()) { | 1299 if (s->calls_sloppy_eval()) { |
1300 // Check that extension is NULL. | 1300 // Check that extension is NULL. |
(...skipping 30 matching lines...) Expand all Loading... |
1331 __ j(not_equal, slow); | 1331 __ j(not_equal, slow); |
1332 // Load next context in chain. | 1332 // Load next context in chain. |
1333 __ mov(temp, ContextOperand(temp, Context::PREVIOUS_INDEX)); | 1333 __ mov(temp, ContextOperand(temp, Context::PREVIOUS_INDEX)); |
1334 __ jmp(&next); | 1334 __ jmp(&next); |
1335 __ bind(&fast); | 1335 __ bind(&fast); |
1336 } | 1336 } |
1337 | 1337 |
1338 // All extension objects were empty and it is safe to use a global | 1338 // All extension objects were empty and it is safe to use a global |
1339 // load IC call. | 1339 // load IC call. |
1340 __ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand()); | 1340 __ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand()); |
1341 __ mov(LoadIC::NameRegister(), var->name()); | 1341 __ mov(LoadIC::NameRegister(), proxy->var()->name()); |
| 1342 if (FLAG_vector_ics) { |
| 1343 __ mov(LoadIC::SlotRegister(), |
| 1344 Immediate(Smi::FromInt(proxy->VariableFeedbackSlot()))); |
| 1345 } |
| 1346 |
1342 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) | 1347 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) |
1343 ? NOT_CONTEXTUAL | 1348 ? NOT_CONTEXTUAL |
1344 : CONTEXTUAL; | 1349 : CONTEXTUAL; |
1345 | 1350 |
1346 CallLoadIC(mode); | 1351 CallLoadIC(mode); |
1347 } | 1352 } |
1348 | 1353 |
1349 | 1354 |
1350 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, | 1355 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, |
1351 Label* slow) { | 1356 Label* slow) { |
(...skipping 18 matching lines...) Expand all Loading... |
1370 __ cmp(ContextOperand(context, Context::EXTENSION_INDEX), Immediate(0)); | 1375 __ cmp(ContextOperand(context, Context::EXTENSION_INDEX), Immediate(0)); |
1371 __ j(not_equal, slow); | 1376 __ j(not_equal, slow); |
1372 | 1377 |
1373 // This function is used only for loads, not stores, so it's safe to | 1378 // This function is used only for loads, not stores, so it's safe to |
1374 // return an esi-based operand (the write barrier cannot be allowed to | 1379 // return an esi-based operand (the write barrier cannot be allowed to |
1375 // destroy the esi register). | 1380 // destroy the esi register). |
1376 return ContextOperand(context, var->index()); | 1381 return ContextOperand(context, var->index()); |
1377 } | 1382 } |
1378 | 1383 |
1379 | 1384 |
1380 void FullCodeGenerator::EmitDynamicLookupFastCase(Variable* var, | 1385 void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy, |
1381 TypeofState typeof_state, | 1386 TypeofState typeof_state, |
1382 Label* slow, | 1387 Label* slow, |
1383 Label* done) { | 1388 Label* done) { |
1384 // Generate fast-case code for variables that might be shadowed by | 1389 // Generate fast-case code for variables that might be shadowed by |
1385 // eval-introduced variables. Eval is used a lot without | 1390 // eval-introduced variables. Eval is used a lot without |
1386 // introducing variables. In those cases, we do not want to | 1391 // introducing variables. In those cases, we do not want to |
1387 // perform a runtime call for all variables in the scope | 1392 // perform a runtime call for all variables in the scope |
1388 // containing the eval. | 1393 // containing the eval. |
| 1394 Variable* var = proxy->var(); |
1389 if (var->mode() == DYNAMIC_GLOBAL) { | 1395 if (var->mode() == DYNAMIC_GLOBAL) { |
1390 EmitLoadGlobalCheckExtensions(var, typeof_state, slow); | 1396 EmitLoadGlobalCheckExtensions(proxy, typeof_state, slow); |
1391 __ jmp(done); | 1397 __ jmp(done); |
1392 } else if (var->mode() == DYNAMIC_LOCAL) { | 1398 } else if (var->mode() == DYNAMIC_LOCAL) { |
1393 Variable* local = var->local_if_not_shadowed(); | 1399 Variable* local = var->local_if_not_shadowed(); |
1394 __ mov(eax, ContextSlotOperandCheckExtensions(local, slow)); | 1400 __ mov(eax, ContextSlotOperandCheckExtensions(local, slow)); |
1395 if (local->mode() == LET || local->mode() == CONST || | 1401 if (local->mode() == LET || local->mode() == CONST || |
1396 local->mode() == CONST_LEGACY) { | 1402 local->mode() == CONST_LEGACY) { |
1397 __ cmp(eax, isolate()->factory()->the_hole_value()); | 1403 __ cmp(eax, isolate()->factory()->the_hole_value()); |
1398 __ j(not_equal, done); | 1404 __ j(not_equal, done); |
1399 if (local->mode() == CONST_LEGACY) { | 1405 if (local->mode() == CONST_LEGACY) { |
1400 __ mov(eax, isolate()->factory()->undefined_value()); | 1406 __ mov(eax, isolate()->factory()->undefined_value()); |
(...skipping 12 matching lines...) Expand all Loading... |
1413 SetSourcePosition(proxy->position()); | 1419 SetSourcePosition(proxy->position()); |
1414 Variable* var = proxy->var(); | 1420 Variable* var = proxy->var(); |
1415 | 1421 |
1416 // Three cases: global variables, lookup variables, and all other types of | 1422 // Three cases: global variables, lookup variables, and all other types of |
1417 // variables. | 1423 // variables. |
1418 switch (var->location()) { | 1424 switch (var->location()) { |
1419 case Variable::UNALLOCATED: { | 1425 case Variable::UNALLOCATED: { |
1420 Comment cmnt(masm_, "[ Global variable"); | 1426 Comment cmnt(masm_, "[ Global variable"); |
1421 __ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand()); | 1427 __ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand()); |
1422 __ mov(LoadIC::NameRegister(), var->name()); | 1428 __ mov(LoadIC::NameRegister(), var->name()); |
| 1429 if (FLAG_vector_ics) { |
| 1430 __ mov(LoadIC::SlotRegister(), |
| 1431 Immediate(Smi::FromInt(proxy->VariableFeedbackSlot()))); |
| 1432 } |
1423 CallLoadIC(CONTEXTUAL); | 1433 CallLoadIC(CONTEXTUAL); |
1424 context()->Plug(eax); | 1434 context()->Plug(eax); |
1425 break; | 1435 break; |
1426 } | 1436 } |
1427 | 1437 |
1428 case Variable::PARAMETER: | 1438 case Variable::PARAMETER: |
1429 case Variable::LOCAL: | 1439 case Variable::LOCAL: |
1430 case Variable::CONTEXT: { | 1440 case Variable::CONTEXT: { |
1431 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" | 1441 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" |
1432 : "[ Stack variable"); | 1442 : "[ Stack variable"); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1488 } | 1498 } |
1489 context()->Plug(var); | 1499 context()->Plug(var); |
1490 break; | 1500 break; |
1491 } | 1501 } |
1492 | 1502 |
1493 case Variable::LOOKUP: { | 1503 case Variable::LOOKUP: { |
1494 Comment cmnt(masm_, "[ Lookup variable"); | 1504 Comment cmnt(masm_, "[ Lookup variable"); |
1495 Label done, slow; | 1505 Label done, slow; |
1496 // Generate code for loading from variables potentially shadowed | 1506 // Generate code for loading from variables potentially shadowed |
1497 // by eval-introduced variables. | 1507 // by eval-introduced variables. |
1498 EmitDynamicLookupFastCase(var, NOT_INSIDE_TYPEOF, &slow, &done); | 1508 EmitDynamicLookupFastCase(proxy, NOT_INSIDE_TYPEOF, &slow, &done); |
1499 __ bind(&slow); | 1509 __ bind(&slow); |
1500 __ push(esi); // Context. | 1510 __ push(esi); // Context. |
1501 __ push(Immediate(var->name())); | 1511 __ push(Immediate(var->name())); |
1502 __ CallRuntime(Runtime::kLoadContextSlot, 2); | 1512 __ CallRuntime(Runtime::kLoadContextSlot, 2); |
1503 __ bind(&done); | 1513 __ bind(&done); |
1504 context()->Plug(eax); | 1514 context()->Plug(eax); |
1505 break; | 1515 break; |
1506 } | 1516 } |
1507 } | 1517 } |
1508 } | 1518 } |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2014 __ bind(&l_next); | 2024 __ bind(&l_next); |
2015 | 2025 |
2016 __ mov(load_name, isolate()->factory()->next_string()); | 2026 __ mov(load_name, isolate()->factory()->next_string()); |
2017 __ push(load_name); // "next" | 2027 __ push(load_name); // "next" |
2018 __ push(Operand(esp, 2 * kPointerSize)); // iter | 2028 __ push(Operand(esp, 2 * kPointerSize)); // iter |
2019 __ push(eax); // received | 2029 __ push(eax); // received |
2020 | 2030 |
2021 // result = receiver[f](arg); | 2031 // result = receiver[f](arg); |
2022 __ bind(&l_call); | 2032 __ bind(&l_call); |
2023 __ mov(load_receiver, Operand(esp, kPointerSize)); | 2033 __ mov(load_receiver, Operand(esp, kPointerSize)); |
| 2034 if (FLAG_vector_ics) { |
| 2035 __ mov(LoadIC::SlotRegister(), |
| 2036 Immediate(Smi::FromInt(expr->KeyedLoadFeedbackSlot()))); |
| 2037 } |
2024 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 2038 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
2025 CallIC(ic, TypeFeedbackId::None()); | 2039 CallIC(ic, TypeFeedbackId::None()); |
2026 __ mov(edi, eax); | 2040 __ mov(edi, eax); |
2027 __ mov(Operand(esp, 2 * kPointerSize), edi); | 2041 __ mov(Operand(esp, 2 * kPointerSize), edi); |
2028 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 2042 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
2029 __ CallStub(&stub); | 2043 __ CallStub(&stub); |
2030 | 2044 |
2031 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2045 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
2032 __ Drop(1); // The function is still on the stack; drop it. | 2046 __ Drop(1); // The function is still on the stack; drop it. |
2033 | 2047 |
2034 // if (!result.done) goto l_try; | 2048 // if (!result.done) goto l_try; |
2035 __ bind(&l_loop); | 2049 __ bind(&l_loop); |
2036 __ push(eax); // save result | 2050 __ push(eax); // save result |
2037 __ Move(load_receiver, eax); // result | 2051 __ Move(load_receiver, eax); // result |
2038 __ mov(load_name, | 2052 __ mov(load_name, |
2039 isolate()->factory()->done_string()); // "done" | 2053 isolate()->factory()->done_string()); // "done" |
| 2054 if (FLAG_vector_ics) { |
| 2055 __ mov(LoadIC::SlotRegister(), |
| 2056 Immediate(Smi::FromInt(expr->DoneFeedbackSlot()))); |
| 2057 } |
2040 CallLoadIC(NOT_CONTEXTUAL); // result.done in eax | 2058 CallLoadIC(NOT_CONTEXTUAL); // result.done in eax |
2041 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); | 2059 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); |
2042 CallIC(bool_ic); | 2060 CallIC(bool_ic); |
2043 __ test(eax, eax); | 2061 __ test(eax, eax); |
2044 __ j(zero, &l_try); | 2062 __ j(zero, &l_try); |
2045 | 2063 |
2046 // result.value | 2064 // result.value |
2047 __ pop(load_receiver); // result | 2065 __ pop(load_receiver); // result |
2048 __ mov(load_name, | 2066 __ mov(load_name, |
2049 isolate()->factory()->value_string()); // "value" | 2067 isolate()->factory()->value_string()); // "value" |
| 2068 if (FLAG_vector_ics) { |
| 2069 __ mov(LoadIC::SlotRegister(), |
| 2070 Immediate(Smi::FromInt(expr->ValueFeedbackSlot()))); |
| 2071 } |
2050 CallLoadIC(NOT_CONTEXTUAL); // result.value in eax | 2072 CallLoadIC(NOT_CONTEXTUAL); // result.value in eax |
2051 context()->DropAndPlug(2, eax); // drop iter and g | 2073 context()->DropAndPlug(2, eax); // drop iter and g |
2052 break; | 2074 break; |
2053 } | 2075 } |
2054 } | 2076 } |
2055 } | 2077 } |
2056 | 2078 |
2057 | 2079 |
2058 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, | 2080 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, |
2059 Expression *value, | 2081 Expression *value, |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2200 __ RecordWriteField(eax, JSGeneratorObject::kResultValuePropertyOffset, | 2222 __ RecordWriteField(eax, JSGeneratorObject::kResultValuePropertyOffset, |
2201 ecx, edx, kDontSaveFPRegs); | 2223 ecx, edx, kDontSaveFPRegs); |
2202 } | 2224 } |
2203 | 2225 |
2204 | 2226 |
2205 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2227 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
2206 SetSourcePosition(prop->position()); | 2228 SetSourcePosition(prop->position()); |
2207 Literal* key = prop->key()->AsLiteral(); | 2229 Literal* key = prop->key()->AsLiteral(); |
2208 ASSERT(!key->value()->IsSmi()); | 2230 ASSERT(!key->value()->IsSmi()); |
2209 __ mov(LoadIC::NameRegister(), Immediate(key->value())); | 2231 __ mov(LoadIC::NameRegister(), Immediate(key->value())); |
2210 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); | 2232 if (FLAG_vector_ics) { |
| 2233 __ mov(LoadIC::SlotRegister(), |
| 2234 Immediate(Smi::FromInt(prop->PropertyFeedbackSlot()))); |
| 2235 CallLoadIC(NOT_CONTEXTUAL); |
| 2236 } else { |
| 2237 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); |
| 2238 } |
2211 } | 2239 } |
2212 | 2240 |
2213 | 2241 |
2214 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2242 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
2215 SetSourcePosition(prop->position()); | 2243 SetSourcePosition(prop->position()); |
2216 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 2244 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
2217 CallIC(ic, prop->PropertyFeedbackId()); | 2245 if (FLAG_vector_ics) { |
| 2246 __ mov(LoadIC::SlotRegister(), |
| 2247 Immediate(Smi::FromInt(prop->PropertyFeedbackSlot()))); |
| 2248 CallIC(ic); |
| 2249 } else { |
| 2250 CallIC(ic, prop->PropertyFeedbackId()); |
| 2251 } |
2218 } | 2252 } |
2219 | 2253 |
2220 | 2254 |
2221 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, | 2255 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
2222 Token::Value op, | 2256 Token::Value op, |
2223 OverwriteMode mode, | 2257 OverwriteMode mode, |
2224 Expression* left, | 2258 Expression* left, |
2225 Expression* right) { | 2259 Expression* right) { |
2226 // Do combined smi check of the operands. Left operand is on the | 2260 // Do combined smi check of the operands. Left operand is on the |
2227 // stack. Right operand is in eax. | 2261 // stack. Right operand is in eax. |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2679 } else if (call_type == Call::GLOBAL_CALL) { | 2713 } else if (call_type == Call::GLOBAL_CALL) { |
2680 EmitCallWithLoadIC(expr); | 2714 EmitCallWithLoadIC(expr); |
2681 | 2715 |
2682 } else if (call_type == Call::LOOKUP_SLOT_CALL) { | 2716 } else if (call_type == Call::LOOKUP_SLOT_CALL) { |
2683 // Call to a lookup slot (dynamically introduced variable). | 2717 // Call to a lookup slot (dynamically introduced variable). |
2684 VariableProxy* proxy = callee->AsVariableProxy(); | 2718 VariableProxy* proxy = callee->AsVariableProxy(); |
2685 Label slow, done; | 2719 Label slow, done; |
2686 { PreservePositionScope scope(masm()->positions_recorder()); | 2720 { PreservePositionScope scope(masm()->positions_recorder()); |
2687 // Generate code for loading from variables potentially shadowed by | 2721 // Generate code for loading from variables potentially shadowed by |
2688 // eval-introduced variables. | 2722 // eval-introduced variables. |
2689 EmitDynamicLookupFastCase(proxy->var(), NOT_INSIDE_TYPEOF, &slow, &done); | 2723 EmitDynamicLookupFastCase(proxy, NOT_INSIDE_TYPEOF, &slow, &done); |
2690 } | 2724 } |
2691 __ bind(&slow); | 2725 __ bind(&slow); |
2692 // Call the runtime to find the function to call (returned in eax) and | 2726 // Call the runtime to find the function to call (returned in eax) and |
2693 // the object holding it (returned in edx). | 2727 // the object holding it (returned in edx). |
2694 __ push(context_register()); | 2728 __ push(context_register()); |
2695 __ push(Immediate(proxy->name())); | 2729 __ push(Immediate(proxy->name())); |
2696 __ CallRuntime(Runtime::kLoadContextSlot, 2); | 2730 __ CallRuntime(Runtime::kLoadContextSlot, 2); |
2697 __ push(eax); // Function. | 2731 __ push(eax); // Function. |
2698 __ push(edx); // Receiver. | 2732 __ push(edx); // Receiver. |
2699 | 2733 |
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4021 ZoneList<Expression*>* args = expr->arguments(); | 4055 ZoneList<Expression*>* args = expr->arguments(); |
4022 | 4056 |
4023 if (expr->is_jsruntime()) { | 4057 if (expr->is_jsruntime()) { |
4024 // Push the builtins object as receiver. | 4058 // Push the builtins object as receiver. |
4025 __ mov(eax, GlobalObjectOperand()); | 4059 __ mov(eax, GlobalObjectOperand()); |
4026 __ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset)); | 4060 __ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset)); |
4027 | 4061 |
4028 // Load the function from the receiver. | 4062 // Load the function from the receiver. |
4029 __ mov(LoadIC::ReceiverRegister(), Operand(esp, 0)); | 4063 __ mov(LoadIC::ReceiverRegister(), Operand(esp, 0)); |
4030 __ mov(LoadIC::NameRegister(), Immediate(expr->name())); | 4064 __ mov(LoadIC::NameRegister(), Immediate(expr->name())); |
4031 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); | 4065 if (FLAG_vector_ics) { |
| 4066 __ mov(LoadIC::SlotRegister(), |
| 4067 Immediate(Smi::FromInt(expr->CallRuntimeFeedbackSlot()))); |
| 4068 CallLoadIC(NOT_CONTEXTUAL); |
| 4069 } else { |
| 4070 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); |
| 4071 } |
4032 | 4072 |
4033 // Push the target function under the receiver. | 4073 // Push the target function under the receiver. |
4034 __ push(Operand(esp, 0)); | 4074 __ push(Operand(esp, 0)); |
4035 __ mov(Operand(esp, kPointerSize), eax); | 4075 __ mov(Operand(esp, kPointerSize), eax); |
4036 | 4076 |
4037 // Code common for calls using the IC. | 4077 // Code common for calls using the IC. |
4038 ZoneList<Expression*>* args = expr->arguments(); | 4078 ZoneList<Expression*>* args = expr->arguments(); |
4039 int arg_count = args->length(); | 4079 int arg_count = args->length(); |
4040 for (int i = 0; i < arg_count; i++) { | 4080 for (int i = 0; i < arg_count; i++) { |
4041 VisitForStackValue(args->at(i)); | 4081 VisitForStackValue(args->at(i)); |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4369 | 4409 |
4370 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { | 4410 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { |
4371 VariableProxy* proxy = expr->AsVariableProxy(); | 4411 VariableProxy* proxy = expr->AsVariableProxy(); |
4372 ASSERT(!context()->IsEffect()); | 4412 ASSERT(!context()->IsEffect()); |
4373 ASSERT(!context()->IsTest()); | 4413 ASSERT(!context()->IsTest()); |
4374 | 4414 |
4375 if (proxy != NULL && proxy->var()->IsUnallocated()) { | 4415 if (proxy != NULL && proxy->var()->IsUnallocated()) { |
4376 Comment cmnt(masm_, "[ Global variable"); | 4416 Comment cmnt(masm_, "[ Global variable"); |
4377 __ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand()); | 4417 __ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand()); |
4378 __ mov(LoadIC::NameRegister(), Immediate(proxy->name())); | 4418 __ mov(LoadIC::NameRegister(), Immediate(proxy->name())); |
| 4419 if (FLAG_vector_ics) { |
| 4420 __ mov(LoadIC::SlotRegister(), |
| 4421 Immediate(Smi::FromInt(proxy->VariableFeedbackSlot()))); |
| 4422 } |
4379 // Use a regular load, not a contextual load, to avoid a reference | 4423 // Use a regular load, not a contextual load, to avoid a reference |
4380 // error. | 4424 // error. |
4381 CallLoadIC(NOT_CONTEXTUAL); | 4425 CallLoadIC(NOT_CONTEXTUAL); |
4382 PrepareForBailout(expr, TOS_REG); | 4426 PrepareForBailout(expr, TOS_REG); |
4383 context()->Plug(eax); | 4427 context()->Plug(eax); |
4384 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { | 4428 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { |
4385 Comment cmnt(masm_, "[ Lookup slot"); | 4429 Comment cmnt(masm_, "[ Lookup slot"); |
4386 Label done, slow; | 4430 Label done, slow; |
4387 | 4431 |
4388 // Generate code for loading from variables potentially shadowed | 4432 // Generate code for loading from variables potentially shadowed |
4389 // by eval-introduced variables. | 4433 // by eval-introduced variables. |
4390 EmitDynamicLookupFastCase(proxy->var(), INSIDE_TYPEOF, &slow, &done); | 4434 EmitDynamicLookupFastCase(proxy, INSIDE_TYPEOF, &slow, &done); |
4391 | 4435 |
4392 __ bind(&slow); | 4436 __ bind(&slow); |
4393 __ push(esi); | 4437 __ push(esi); |
4394 __ push(Immediate(proxy->name())); | 4438 __ push(Immediate(proxy->name())); |
4395 __ CallRuntime(Runtime::kLoadContextSlotNoReferenceError, 2); | 4439 __ CallRuntime(Runtime::kLoadContextSlotNoReferenceError, 2); |
4396 PrepareForBailout(expr, TOS_REG); | 4440 PrepareForBailout(expr, TOS_REG); |
4397 __ bind(&done); | 4441 __ bind(&done); |
4398 | 4442 |
4399 context()->Plug(eax); | 4443 context()->Plug(eax); |
4400 } else { | 4444 } else { |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4802 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4846 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
4803 Assembler::target_address_at(call_target_address, | 4847 Assembler::target_address_at(call_target_address, |
4804 unoptimized_code)); | 4848 unoptimized_code)); |
4805 return OSR_AFTER_STACK_CHECK; | 4849 return OSR_AFTER_STACK_CHECK; |
4806 } | 4850 } |
4807 | 4851 |
4808 | 4852 |
4809 } } // namespace v8::internal | 4853 } } // namespace v8::internal |
4810 | 4854 |
4811 #endif // V8_TARGET_ARCH_IA32 | 4855 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |