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::kLoadLookupSlot, 2); | 1512 __ CallRuntime(Runtime::kLoadLookupSlot, 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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2015 __ bind(&l_next); | 2025 __ bind(&l_next); |
2016 | 2026 |
2017 __ mov(load_name, isolate()->factory()->next_string()); | 2027 __ mov(load_name, isolate()->factory()->next_string()); |
2018 __ push(load_name); // "next" | 2028 __ push(load_name); // "next" |
2019 __ push(Operand(esp, 2 * kPointerSize)); // iter | 2029 __ push(Operand(esp, 2 * kPointerSize)); // iter |
2020 __ push(eax); // received | 2030 __ push(eax); // received |
2021 | 2031 |
2022 // result = receiver[f](arg); | 2032 // result = receiver[f](arg); |
2023 __ bind(&l_call); | 2033 __ bind(&l_call); |
2024 __ mov(load_receiver, Operand(esp, kPointerSize)); | 2034 __ mov(load_receiver, Operand(esp, kPointerSize)); |
| 2035 if (FLAG_vector_ics) { |
| 2036 __ mov(LoadIC::SlotRegister(), |
| 2037 Immediate(Smi::FromInt(expr->KeyedLoadFeedbackSlot()))); |
| 2038 } |
2025 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 2039 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
2026 CallIC(ic, TypeFeedbackId::None()); | 2040 CallIC(ic, TypeFeedbackId::None()); |
2027 __ mov(edi, eax); | 2041 __ mov(edi, eax); |
2028 __ mov(Operand(esp, 2 * kPointerSize), edi); | 2042 __ mov(Operand(esp, 2 * kPointerSize), edi); |
2029 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 2043 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
2030 __ CallStub(&stub); | 2044 __ CallStub(&stub); |
2031 | 2045 |
2032 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2046 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
2033 __ Drop(1); // The function is still on the stack; drop it. | 2047 __ Drop(1); // The function is still on the stack; drop it. |
2034 | 2048 |
2035 // if (!result.done) goto l_try; | 2049 // if (!result.done) goto l_try; |
2036 __ bind(&l_loop); | 2050 __ bind(&l_loop); |
2037 __ push(eax); // save result | 2051 __ push(eax); // save result |
2038 __ Move(load_receiver, eax); // result | 2052 __ Move(load_receiver, eax); // result |
2039 __ mov(load_name, | 2053 __ mov(load_name, |
2040 isolate()->factory()->done_string()); // "done" | 2054 isolate()->factory()->done_string()); // "done" |
| 2055 if (FLAG_vector_ics) { |
| 2056 __ mov(LoadIC::SlotRegister(), |
| 2057 Immediate(Smi::FromInt(expr->DoneFeedbackSlot()))); |
| 2058 } |
2041 CallLoadIC(NOT_CONTEXTUAL); // result.done in eax | 2059 CallLoadIC(NOT_CONTEXTUAL); // result.done in eax |
2042 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); | 2060 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); |
2043 CallIC(bool_ic); | 2061 CallIC(bool_ic); |
2044 __ test(eax, eax); | 2062 __ test(eax, eax); |
2045 __ j(zero, &l_try); | 2063 __ j(zero, &l_try); |
2046 | 2064 |
2047 // result.value | 2065 // result.value |
2048 __ pop(load_receiver); // result | 2066 __ pop(load_receiver); // result |
2049 __ mov(load_name, | 2067 __ mov(load_name, |
2050 isolate()->factory()->value_string()); // "value" | 2068 isolate()->factory()->value_string()); // "value" |
| 2069 if (FLAG_vector_ics) { |
| 2070 __ mov(LoadIC::SlotRegister(), |
| 2071 Immediate(Smi::FromInt(expr->ValueFeedbackSlot()))); |
| 2072 } |
2051 CallLoadIC(NOT_CONTEXTUAL); // result.value in eax | 2073 CallLoadIC(NOT_CONTEXTUAL); // result.value in eax |
2052 context()->DropAndPlug(2, eax); // drop iter and g | 2074 context()->DropAndPlug(2, eax); // drop iter and g |
2053 break; | 2075 break; |
2054 } | 2076 } |
2055 } | 2077 } |
2056 } | 2078 } |
2057 | 2079 |
2058 | 2080 |
2059 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, | 2081 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, |
2060 Expression *value, | 2082 Expression *value, |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2201 __ RecordWriteField(eax, JSGeneratorObject::kResultValuePropertyOffset, | 2223 __ RecordWriteField(eax, JSGeneratorObject::kResultValuePropertyOffset, |
2202 ecx, edx, kDontSaveFPRegs); | 2224 ecx, edx, kDontSaveFPRegs); |
2203 } | 2225 } |
2204 | 2226 |
2205 | 2227 |
2206 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2228 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
2207 SetSourcePosition(prop->position()); | 2229 SetSourcePosition(prop->position()); |
2208 Literal* key = prop->key()->AsLiteral(); | 2230 Literal* key = prop->key()->AsLiteral(); |
2209 ASSERT(!key->value()->IsSmi()); | 2231 ASSERT(!key->value()->IsSmi()); |
2210 __ mov(LoadIC::NameRegister(), Immediate(key->value())); | 2232 __ mov(LoadIC::NameRegister(), Immediate(key->value())); |
2211 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); | 2233 if (FLAG_vector_ics) { |
| 2234 __ mov(LoadIC::SlotRegister(), |
| 2235 Immediate(Smi::FromInt(prop->PropertyFeedbackSlot()))); |
| 2236 CallLoadIC(NOT_CONTEXTUAL); |
| 2237 } else { |
| 2238 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); |
| 2239 } |
2212 } | 2240 } |
2213 | 2241 |
2214 | 2242 |
2215 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2243 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
2216 SetSourcePosition(prop->position()); | 2244 SetSourcePosition(prop->position()); |
2217 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 2245 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
2218 CallIC(ic, prop->PropertyFeedbackId()); | 2246 if (FLAG_vector_ics) { |
| 2247 __ mov(LoadIC::SlotRegister(), |
| 2248 Immediate(Smi::FromInt(prop->PropertyFeedbackSlot()))); |
| 2249 CallIC(ic); |
| 2250 } else { |
| 2251 CallIC(ic, prop->PropertyFeedbackId()); |
| 2252 } |
2219 } | 2253 } |
2220 | 2254 |
2221 | 2255 |
2222 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, | 2256 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
2223 Token::Value op, | 2257 Token::Value op, |
2224 OverwriteMode mode, | 2258 OverwriteMode mode, |
2225 Expression* left, | 2259 Expression* left, |
2226 Expression* right) { | 2260 Expression* right) { |
2227 // Do combined smi check of the operands. Left operand is on the | 2261 // Do combined smi check of the operands. Left operand is on the |
2228 // stack. Right operand is in eax. | 2262 // stack. Right operand is in eax. |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2673 } else if (call_type == Call::GLOBAL_CALL) { | 2707 } else if (call_type == Call::GLOBAL_CALL) { |
2674 EmitCallWithLoadIC(expr); | 2708 EmitCallWithLoadIC(expr); |
2675 | 2709 |
2676 } else if (call_type == Call::LOOKUP_SLOT_CALL) { | 2710 } else if (call_type == Call::LOOKUP_SLOT_CALL) { |
2677 // Call to a lookup slot (dynamically introduced variable). | 2711 // Call to a lookup slot (dynamically introduced variable). |
2678 VariableProxy* proxy = callee->AsVariableProxy(); | 2712 VariableProxy* proxy = callee->AsVariableProxy(); |
2679 Label slow, done; | 2713 Label slow, done; |
2680 { PreservePositionScope scope(masm()->positions_recorder()); | 2714 { PreservePositionScope scope(masm()->positions_recorder()); |
2681 // Generate code for loading from variables potentially shadowed by | 2715 // Generate code for loading from variables potentially shadowed by |
2682 // eval-introduced variables. | 2716 // eval-introduced variables. |
2683 EmitDynamicLookupFastCase(proxy->var(), NOT_INSIDE_TYPEOF, &slow, &done); | 2717 EmitDynamicLookupFastCase(proxy, NOT_INSIDE_TYPEOF, &slow, &done); |
2684 } | 2718 } |
2685 __ bind(&slow); | 2719 __ bind(&slow); |
2686 // Call the runtime to find the function to call (returned in eax) and | 2720 // Call the runtime to find the function to call (returned in eax) and |
2687 // the object holding it (returned in edx). | 2721 // the object holding it (returned in edx). |
2688 __ push(context_register()); | 2722 __ push(context_register()); |
2689 __ push(Immediate(proxy->name())); | 2723 __ push(Immediate(proxy->name())); |
2690 __ CallRuntime(Runtime::kLoadLookupSlot, 2); | 2724 __ CallRuntime(Runtime::kLoadLookupSlot, 2); |
2691 __ push(eax); // Function. | 2725 __ push(eax); // Function. |
2692 __ push(edx); // Receiver. | 2726 __ push(edx); // Receiver. |
2693 | 2727 |
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4015 ZoneList<Expression*>* args = expr->arguments(); | 4049 ZoneList<Expression*>* args = expr->arguments(); |
4016 | 4050 |
4017 if (expr->is_jsruntime()) { | 4051 if (expr->is_jsruntime()) { |
4018 // Push the builtins object as receiver. | 4052 // Push the builtins object as receiver. |
4019 __ mov(eax, GlobalObjectOperand()); | 4053 __ mov(eax, GlobalObjectOperand()); |
4020 __ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset)); | 4054 __ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset)); |
4021 | 4055 |
4022 // Load the function from the receiver. | 4056 // Load the function from the receiver. |
4023 __ mov(LoadIC::ReceiverRegister(), Operand(esp, 0)); | 4057 __ mov(LoadIC::ReceiverRegister(), Operand(esp, 0)); |
4024 __ mov(LoadIC::NameRegister(), Immediate(expr->name())); | 4058 __ mov(LoadIC::NameRegister(), Immediate(expr->name())); |
4025 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); | 4059 if (FLAG_vector_ics) { |
| 4060 __ mov(LoadIC::SlotRegister(), |
| 4061 Immediate(Smi::FromInt(expr->CallRuntimeFeedbackSlot()))); |
| 4062 CallLoadIC(NOT_CONTEXTUAL); |
| 4063 } else { |
| 4064 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); |
| 4065 } |
4026 | 4066 |
4027 // Push the target function under the receiver. | 4067 // Push the target function under the receiver. |
4028 __ push(Operand(esp, 0)); | 4068 __ push(Operand(esp, 0)); |
4029 __ mov(Operand(esp, kPointerSize), eax); | 4069 __ mov(Operand(esp, kPointerSize), eax); |
4030 | 4070 |
4031 // Code common for calls using the IC. | 4071 // Code common for calls using the IC. |
4032 ZoneList<Expression*>* args = expr->arguments(); | 4072 ZoneList<Expression*>* args = expr->arguments(); |
4033 int arg_count = args->length(); | 4073 int arg_count = args->length(); |
4034 for (int i = 0; i < arg_count; i++) { | 4074 for (int i = 0; i < arg_count; i++) { |
4035 VisitForStackValue(args->at(i)); | 4075 VisitForStackValue(args->at(i)); |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4363 | 4403 |
4364 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { | 4404 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { |
4365 VariableProxy* proxy = expr->AsVariableProxy(); | 4405 VariableProxy* proxy = expr->AsVariableProxy(); |
4366 ASSERT(!context()->IsEffect()); | 4406 ASSERT(!context()->IsEffect()); |
4367 ASSERT(!context()->IsTest()); | 4407 ASSERT(!context()->IsTest()); |
4368 | 4408 |
4369 if (proxy != NULL && proxy->var()->IsUnallocated()) { | 4409 if (proxy != NULL && proxy->var()->IsUnallocated()) { |
4370 Comment cmnt(masm_, "[ Global variable"); | 4410 Comment cmnt(masm_, "[ Global variable"); |
4371 __ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand()); | 4411 __ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand()); |
4372 __ mov(LoadIC::NameRegister(), Immediate(proxy->name())); | 4412 __ mov(LoadIC::NameRegister(), Immediate(proxy->name())); |
| 4413 if (FLAG_vector_ics) { |
| 4414 __ mov(LoadIC::SlotRegister(), |
| 4415 Immediate(Smi::FromInt(proxy->VariableFeedbackSlot()))); |
| 4416 } |
4373 // Use a regular load, not a contextual load, to avoid a reference | 4417 // Use a regular load, not a contextual load, to avoid a reference |
4374 // error. | 4418 // error. |
4375 CallLoadIC(NOT_CONTEXTUAL); | 4419 CallLoadIC(NOT_CONTEXTUAL); |
4376 PrepareForBailout(expr, TOS_REG); | 4420 PrepareForBailout(expr, TOS_REG); |
4377 context()->Plug(eax); | 4421 context()->Plug(eax); |
4378 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { | 4422 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { |
4379 Comment cmnt(masm_, "[ Lookup slot"); | 4423 Comment cmnt(masm_, "[ Lookup slot"); |
4380 Label done, slow; | 4424 Label done, slow; |
4381 | 4425 |
4382 // Generate code for loading from variables potentially shadowed | 4426 // Generate code for loading from variables potentially shadowed |
4383 // by eval-introduced variables. | 4427 // by eval-introduced variables. |
4384 EmitDynamicLookupFastCase(proxy->var(), INSIDE_TYPEOF, &slow, &done); | 4428 EmitDynamicLookupFastCase(proxy, INSIDE_TYPEOF, &slow, &done); |
4385 | 4429 |
4386 __ bind(&slow); | 4430 __ bind(&slow); |
4387 __ push(esi); | 4431 __ push(esi); |
4388 __ push(Immediate(proxy->name())); | 4432 __ push(Immediate(proxy->name())); |
4389 __ CallRuntime(Runtime::kLoadLookupSlotNoReferenceError, 2); | 4433 __ CallRuntime(Runtime::kLoadLookupSlotNoReferenceError, 2); |
4390 PrepareForBailout(expr, TOS_REG); | 4434 PrepareForBailout(expr, TOS_REG); |
4391 __ bind(&done); | 4435 __ bind(&done); |
4392 | 4436 |
4393 context()->Plug(eax); | 4437 context()->Plug(eax); |
4394 } else { | 4438 } else { |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4790 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4834 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
4791 Assembler::target_address_at(call_target_address, | 4835 Assembler::target_address_at(call_target_address, |
4792 unoptimized_code)); | 4836 unoptimized_code)); |
4793 return OSR_AFTER_STACK_CHECK; | 4837 return OSR_AFTER_STACK_CHECK; |
4794 } | 4838 } |
4795 | 4839 |
4796 | 4840 |
4797 } } // namespace v8::internal | 4841 } } // namespace v8::internal |
4798 | 4842 |
4799 #endif // V8_TARGET_ARCH_IA32 | 4843 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |