| 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_X87 | 7 #if V8_TARGET_ARCH_X87 |
| 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 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1277 context()->Plug(eax); | 1277 context()->Plug(eax); |
| 1278 } | 1278 } |
| 1279 | 1279 |
| 1280 | 1280 |
| 1281 void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { | 1281 void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { |
| 1282 Comment cmnt(masm_, "[ VariableProxy"); | 1282 Comment cmnt(masm_, "[ VariableProxy"); |
| 1283 EmitVariableLoad(expr); | 1283 EmitVariableLoad(expr); |
| 1284 } | 1284 } |
| 1285 | 1285 |
| 1286 | 1286 |
| 1287 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var, | 1287 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, |
| 1288 TypeofState typeof_state, | 1288 TypeofState typeof_state, |
| 1289 Label* slow) { | 1289 Label* slow) { |
| 1290 Register context = esi; | 1290 Register context = esi; |
| 1291 Register temp = edx; | 1291 Register temp = edx; |
| 1292 | 1292 |
| 1293 Scope* s = scope(); | 1293 Scope* s = scope(); |
| 1294 while (s != NULL) { | 1294 while (s != NULL) { |
| 1295 if (s->num_heap_slots() > 0) { | 1295 if (s->num_heap_slots() > 0) { |
| 1296 if (s->calls_sloppy_eval()) { | 1296 if (s->calls_sloppy_eval()) { |
| 1297 // Check that extension is NULL. | 1297 // Check that extension is NULL. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1328 __ j(not_equal, slow); | 1328 __ j(not_equal, slow); |
| 1329 // Load next context in chain. | 1329 // Load next context in chain. |
| 1330 __ mov(temp, ContextOperand(temp, Context::PREVIOUS_INDEX)); | 1330 __ mov(temp, ContextOperand(temp, Context::PREVIOUS_INDEX)); |
| 1331 __ jmp(&next); | 1331 __ jmp(&next); |
| 1332 __ bind(&fast); | 1332 __ bind(&fast); |
| 1333 } | 1333 } |
| 1334 | 1334 |
| 1335 // All extension objects were empty and it is safe to use a global | 1335 // All extension objects were empty and it is safe to use a global |
| 1336 // load IC call. | 1336 // load IC call. |
| 1337 __ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand()); | 1337 __ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand()); |
| 1338 __ mov(LoadIC::NameRegister(), var->name()); | 1338 __ mov(LoadIC::NameRegister(), proxy->var()->name()); |
| 1339 if (FLAG_vector_ics) { |
| 1340 __ mov(LoadIC::SlotRegister(), |
| 1341 Immediate(Smi::FromInt(proxy->VariableFeedbackSlot()))); |
| 1342 } |
| 1343 |
| 1339 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) | 1344 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) |
| 1340 ? NOT_CONTEXTUAL | 1345 ? NOT_CONTEXTUAL |
| 1341 : CONTEXTUAL; | 1346 : CONTEXTUAL; |
| 1342 | 1347 |
| 1343 CallLoadIC(mode); | 1348 CallLoadIC(mode); |
| 1344 } | 1349 } |
| 1345 | 1350 |
| 1346 | 1351 |
| 1347 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, | 1352 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, |
| 1348 Label* slow) { | 1353 Label* slow) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1367 __ cmp(ContextOperand(context, Context::EXTENSION_INDEX), Immediate(0)); | 1372 __ cmp(ContextOperand(context, Context::EXTENSION_INDEX), Immediate(0)); |
| 1368 __ j(not_equal, slow); | 1373 __ j(not_equal, slow); |
| 1369 | 1374 |
| 1370 // This function is used only for loads, not stores, so it's safe to | 1375 // This function is used only for loads, not stores, so it's safe to |
| 1371 // return an esi-based operand (the write barrier cannot be allowed to | 1376 // return an esi-based operand (the write barrier cannot be allowed to |
| 1372 // destroy the esi register). | 1377 // destroy the esi register). |
| 1373 return ContextOperand(context, var->index()); | 1378 return ContextOperand(context, var->index()); |
| 1374 } | 1379 } |
| 1375 | 1380 |
| 1376 | 1381 |
| 1377 void FullCodeGenerator::EmitDynamicLookupFastCase(Variable* var, | 1382 void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy, |
| 1378 TypeofState typeof_state, | 1383 TypeofState typeof_state, |
| 1379 Label* slow, | 1384 Label* slow, |
| 1380 Label* done) { | 1385 Label* done) { |
| 1381 // Generate fast-case code for variables that might be shadowed by | 1386 // Generate fast-case code for variables that might be shadowed by |
| 1382 // eval-introduced variables. Eval is used a lot without | 1387 // eval-introduced variables. Eval is used a lot without |
| 1383 // introducing variables. In those cases, we do not want to | 1388 // introducing variables. In those cases, we do not want to |
| 1384 // perform a runtime call for all variables in the scope | 1389 // perform a runtime call for all variables in the scope |
| 1385 // containing the eval. | 1390 // containing the eval. |
| 1391 Variable* var = proxy->var(); |
| 1386 if (var->mode() == DYNAMIC_GLOBAL) { | 1392 if (var->mode() == DYNAMIC_GLOBAL) { |
| 1387 EmitLoadGlobalCheckExtensions(var, typeof_state, slow); | 1393 EmitLoadGlobalCheckExtensions(proxy, typeof_state, slow); |
| 1388 __ jmp(done); | 1394 __ jmp(done); |
| 1389 } else if (var->mode() == DYNAMIC_LOCAL) { | 1395 } else if (var->mode() == DYNAMIC_LOCAL) { |
| 1390 Variable* local = var->local_if_not_shadowed(); | 1396 Variable* local = var->local_if_not_shadowed(); |
| 1391 __ mov(eax, ContextSlotOperandCheckExtensions(local, slow)); | 1397 __ mov(eax, ContextSlotOperandCheckExtensions(local, slow)); |
| 1392 if (local->mode() == LET || local->mode() == CONST || | 1398 if (local->mode() == LET || local->mode() == CONST || |
| 1393 local->mode() == CONST_LEGACY) { | 1399 local->mode() == CONST_LEGACY) { |
| 1394 __ cmp(eax, isolate()->factory()->the_hole_value()); | 1400 __ cmp(eax, isolate()->factory()->the_hole_value()); |
| 1395 __ j(not_equal, done); | 1401 __ j(not_equal, done); |
| 1396 if (local->mode() == CONST_LEGACY) { | 1402 if (local->mode() == CONST_LEGACY) { |
| 1397 __ mov(eax, isolate()->factory()->undefined_value()); | 1403 __ mov(eax, isolate()->factory()->undefined_value()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1410 SetSourcePosition(proxy->position()); | 1416 SetSourcePosition(proxy->position()); |
| 1411 Variable* var = proxy->var(); | 1417 Variable* var = proxy->var(); |
| 1412 | 1418 |
| 1413 // Three cases: global variables, lookup variables, and all other types of | 1419 // Three cases: global variables, lookup variables, and all other types of |
| 1414 // variables. | 1420 // variables. |
| 1415 switch (var->location()) { | 1421 switch (var->location()) { |
| 1416 case Variable::UNALLOCATED: { | 1422 case Variable::UNALLOCATED: { |
| 1417 Comment cmnt(masm_, "[ Global variable"); | 1423 Comment cmnt(masm_, "[ Global variable"); |
| 1418 __ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand()); | 1424 __ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand()); |
| 1419 __ mov(LoadIC::NameRegister(), var->name()); | 1425 __ mov(LoadIC::NameRegister(), var->name()); |
| 1426 if (FLAG_vector_ics) { |
| 1427 __ mov(LoadIC::SlotRegister(), |
| 1428 Immediate(Smi::FromInt(proxy->VariableFeedbackSlot()))); |
| 1429 } |
| 1420 CallLoadIC(CONTEXTUAL); | 1430 CallLoadIC(CONTEXTUAL); |
| 1421 context()->Plug(eax); | 1431 context()->Plug(eax); |
| 1422 break; | 1432 break; |
| 1423 } | 1433 } |
| 1424 | 1434 |
| 1425 case Variable::PARAMETER: | 1435 case Variable::PARAMETER: |
| 1426 case Variable::LOCAL: | 1436 case Variable::LOCAL: |
| 1427 case Variable::CONTEXT: { | 1437 case Variable::CONTEXT: { |
| 1428 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" | 1438 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" |
| 1429 : "[ Stack variable"); | 1439 : "[ Stack variable"); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1485 } | 1495 } |
| 1486 context()->Plug(var); | 1496 context()->Plug(var); |
| 1487 break; | 1497 break; |
| 1488 } | 1498 } |
| 1489 | 1499 |
| 1490 case Variable::LOOKUP: { | 1500 case Variable::LOOKUP: { |
| 1491 Comment cmnt(masm_, "[ Lookup variable"); | 1501 Comment cmnt(masm_, "[ Lookup variable"); |
| 1492 Label done, slow; | 1502 Label done, slow; |
| 1493 // Generate code for loading from variables potentially shadowed | 1503 // Generate code for loading from variables potentially shadowed |
| 1494 // by eval-introduced variables. | 1504 // by eval-introduced variables. |
| 1495 EmitDynamicLookupFastCase(var, NOT_INSIDE_TYPEOF, &slow, &done); | 1505 EmitDynamicLookupFastCase(proxy, NOT_INSIDE_TYPEOF, &slow, &done); |
| 1496 __ bind(&slow); | 1506 __ bind(&slow); |
| 1497 __ push(esi); // Context. | 1507 __ push(esi); // Context. |
| 1498 __ push(Immediate(var->name())); | 1508 __ push(Immediate(var->name())); |
| 1499 __ CallRuntime(Runtime::kLoadLookupSlot, 2); | 1509 __ CallRuntime(Runtime::kLoadLookupSlot, 2); |
| 1500 __ bind(&done); | 1510 __ bind(&done); |
| 1501 context()->Plug(eax); | 1511 context()->Plug(eax); |
| 1502 break; | 1512 break; |
| 1503 } | 1513 } |
| 1504 } | 1514 } |
| 1505 } | 1515 } |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2009 __ bind(&l_next); | 2019 __ bind(&l_next); |
| 2010 | 2020 |
| 2011 __ mov(load_name, isolate()->factory()->next_string()); | 2021 __ mov(load_name, isolate()->factory()->next_string()); |
| 2012 __ push(load_name); // "next" | 2022 __ push(load_name); // "next" |
| 2013 __ push(Operand(esp, 2 * kPointerSize)); // iter | 2023 __ push(Operand(esp, 2 * kPointerSize)); // iter |
| 2014 __ push(eax); // received | 2024 __ push(eax); // received |
| 2015 | 2025 |
| 2016 // result = receiver[f](arg); | 2026 // result = receiver[f](arg); |
| 2017 __ bind(&l_call); | 2027 __ bind(&l_call); |
| 2018 __ mov(load_receiver, Operand(esp, kPointerSize)); | 2028 __ mov(load_receiver, Operand(esp, kPointerSize)); |
| 2029 if (FLAG_vector_ics) { |
| 2030 __ mov(LoadIC::SlotRegister(), |
| 2031 Immediate(Smi::FromInt(expr->KeyedLoadFeedbackSlot()))); |
| 2032 } |
| 2019 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 2033 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
| 2020 CallIC(ic, TypeFeedbackId::None()); | 2034 CallIC(ic, TypeFeedbackId::None()); |
| 2021 __ mov(edi, eax); | 2035 __ mov(edi, eax); |
| 2022 __ mov(Operand(esp, 2 * kPointerSize), edi); | 2036 __ mov(Operand(esp, 2 * kPointerSize), edi); |
| 2023 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 2037 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
| 2024 __ CallStub(&stub); | 2038 __ CallStub(&stub); |
| 2025 | 2039 |
| 2026 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2040 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 2027 __ Drop(1); // The function is still on the stack; drop it. | 2041 __ Drop(1); // The function is still on the stack; drop it. |
| 2028 | 2042 |
| 2029 // if (!result.done) goto l_try; | 2043 // if (!result.done) goto l_try; |
| 2030 __ bind(&l_loop); | 2044 __ bind(&l_loop); |
| 2031 __ push(eax); // save result | 2045 __ push(eax); // save result |
| 2032 __ Move(load_receiver, eax); // result | 2046 __ Move(load_receiver, eax); // result |
| 2033 __ mov(load_name, | 2047 __ mov(load_name, |
| 2034 isolate()->factory()->done_string()); // "done" | 2048 isolate()->factory()->done_string()); // "done" |
| 2049 if (FLAG_vector_ics) { |
| 2050 __ mov(LoadIC::SlotRegister(), |
| 2051 Immediate(Smi::FromInt(expr->DoneFeedbackSlot()))); |
| 2052 } |
| 2035 CallLoadIC(NOT_CONTEXTUAL); // result.done in eax | 2053 CallLoadIC(NOT_CONTEXTUAL); // result.done in eax |
| 2036 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); | 2054 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); |
| 2037 CallIC(bool_ic); | 2055 CallIC(bool_ic); |
| 2038 __ test(eax, eax); | 2056 __ test(eax, eax); |
| 2039 __ j(zero, &l_try); | 2057 __ j(zero, &l_try); |
| 2040 | 2058 |
| 2041 // result.value | 2059 // result.value |
| 2042 __ pop(load_receiver); // result | 2060 __ pop(load_receiver); // result |
| 2043 __ mov(load_name, | 2061 __ mov(load_name, |
| 2044 isolate()->factory()->value_string()); // "value" | 2062 isolate()->factory()->value_string()); // "value" |
| 2063 if (FLAG_vector_ics) { |
| 2064 __ mov(LoadIC::SlotRegister(), |
| 2065 Immediate(Smi::FromInt(expr->ValueFeedbackSlot()))); |
| 2066 } |
| 2045 CallLoadIC(NOT_CONTEXTUAL); // result.value in eax | 2067 CallLoadIC(NOT_CONTEXTUAL); // result.value in eax |
| 2046 context()->DropAndPlug(2, eax); // drop iter and g | 2068 context()->DropAndPlug(2, eax); // drop iter and g |
| 2047 break; | 2069 break; |
| 2048 } | 2070 } |
| 2049 } | 2071 } |
| 2050 } | 2072 } |
| 2051 | 2073 |
| 2052 | 2074 |
| 2053 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, | 2075 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, |
| 2054 Expression *value, | 2076 Expression *value, |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2195 __ RecordWriteField(eax, JSGeneratorObject::kResultValuePropertyOffset, | 2217 __ RecordWriteField(eax, JSGeneratorObject::kResultValuePropertyOffset, |
| 2196 ecx, edx); | 2218 ecx, edx); |
| 2197 } | 2219 } |
| 2198 | 2220 |
| 2199 | 2221 |
| 2200 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2222 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
| 2201 SetSourcePosition(prop->position()); | 2223 SetSourcePosition(prop->position()); |
| 2202 Literal* key = prop->key()->AsLiteral(); | 2224 Literal* key = prop->key()->AsLiteral(); |
| 2203 ASSERT(!key->value()->IsSmi()); | 2225 ASSERT(!key->value()->IsSmi()); |
| 2204 __ mov(LoadIC::NameRegister(), Immediate(key->value())); | 2226 __ mov(LoadIC::NameRegister(), Immediate(key->value())); |
| 2205 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); | 2227 if (FLAG_vector_ics) { |
| 2228 __ mov(LoadIC::SlotRegister(), |
| 2229 Immediate(Smi::FromInt(prop->PropertyFeedbackSlot()))); |
| 2230 CallLoadIC(NOT_CONTEXTUAL); |
| 2231 } else { |
| 2232 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); |
| 2233 } |
| 2206 } | 2234 } |
| 2207 | 2235 |
| 2208 | 2236 |
| 2209 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2237 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
| 2210 SetSourcePosition(prop->position()); | 2238 SetSourcePosition(prop->position()); |
| 2211 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 2239 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
| 2212 CallIC(ic, prop->PropertyFeedbackId()); | 2240 if (FLAG_vector_ics) { |
| 2241 __ mov(LoadIC::SlotRegister(), |
| 2242 Immediate(Smi::FromInt(prop->PropertyFeedbackSlot()))); |
| 2243 CallIC(ic); |
| 2244 } else { |
| 2245 CallIC(ic, prop->PropertyFeedbackId()); |
| 2246 } |
| 2213 } | 2247 } |
| 2214 | 2248 |
| 2215 | 2249 |
| 2216 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, | 2250 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
| 2217 Token::Value op, | 2251 Token::Value op, |
| 2218 OverwriteMode mode, | 2252 OverwriteMode mode, |
| 2219 Expression* left, | 2253 Expression* left, |
| 2220 Expression* right) { | 2254 Expression* right) { |
| 2221 // Do combined smi check of the operands. Left operand is on the | 2255 // Do combined smi check of the operands. Left operand is on the |
| 2222 // stack. Right operand is in eax. | 2256 // stack. Right operand is in eax. |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2667 } else if (call_type == Call::GLOBAL_CALL) { | 2701 } else if (call_type == Call::GLOBAL_CALL) { |
| 2668 EmitCallWithLoadIC(expr); | 2702 EmitCallWithLoadIC(expr); |
| 2669 | 2703 |
| 2670 } else if (call_type == Call::LOOKUP_SLOT_CALL) { | 2704 } else if (call_type == Call::LOOKUP_SLOT_CALL) { |
| 2671 // Call to a lookup slot (dynamically introduced variable). | 2705 // Call to a lookup slot (dynamically introduced variable). |
| 2672 VariableProxy* proxy = callee->AsVariableProxy(); | 2706 VariableProxy* proxy = callee->AsVariableProxy(); |
| 2673 Label slow, done; | 2707 Label slow, done; |
| 2674 { PreservePositionScope scope(masm()->positions_recorder()); | 2708 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2675 // Generate code for loading from variables potentially shadowed by | 2709 // Generate code for loading from variables potentially shadowed by |
| 2676 // eval-introduced variables. | 2710 // eval-introduced variables. |
| 2677 EmitDynamicLookupFastCase(proxy->var(), NOT_INSIDE_TYPEOF, &slow, &done); | 2711 EmitDynamicLookupFastCase(proxy, NOT_INSIDE_TYPEOF, &slow, &done); |
| 2678 } | 2712 } |
| 2679 __ bind(&slow); | 2713 __ bind(&slow); |
| 2680 // Call the runtime to find the function to call (returned in eax) and | 2714 // Call the runtime to find the function to call (returned in eax) and |
| 2681 // the object holding it (returned in edx). | 2715 // the object holding it (returned in edx). |
| 2682 __ push(context_register()); | 2716 __ push(context_register()); |
| 2683 __ push(Immediate(proxy->name())); | 2717 __ push(Immediate(proxy->name())); |
| 2684 __ CallRuntime(Runtime::kLoadLookupSlot, 2); | 2718 __ CallRuntime(Runtime::kLoadLookupSlot, 2); |
| 2685 __ push(eax); // Function. | 2719 __ push(eax); // Function. |
| 2686 __ push(edx); // Receiver. | 2720 __ push(edx); // Receiver. |
| 2687 | 2721 |
| (...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4008 ZoneList<Expression*>* args = expr->arguments(); | 4042 ZoneList<Expression*>* args = expr->arguments(); |
| 4009 | 4043 |
| 4010 if (expr->is_jsruntime()) { | 4044 if (expr->is_jsruntime()) { |
| 4011 // Push the builtins object as receiver. | 4045 // Push the builtins object as receiver. |
| 4012 __ mov(eax, GlobalObjectOperand()); | 4046 __ mov(eax, GlobalObjectOperand()); |
| 4013 __ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset)); | 4047 __ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset)); |
| 4014 | 4048 |
| 4015 // Load the function from the receiver. | 4049 // Load the function from the receiver. |
| 4016 __ mov(LoadIC::ReceiverRegister(), Operand(esp, 0)); | 4050 __ mov(LoadIC::ReceiverRegister(), Operand(esp, 0)); |
| 4017 __ mov(LoadIC::NameRegister(), Immediate(expr->name())); | 4051 __ mov(LoadIC::NameRegister(), Immediate(expr->name())); |
| 4018 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); | 4052 if (FLAG_vector_ics) { |
| 4053 __ mov(LoadIC::SlotRegister(), |
| 4054 Immediate(Smi::FromInt(expr->CallRuntimeFeedbackSlot()))); |
| 4055 CallLoadIC(NOT_CONTEXTUAL); |
| 4056 } else { |
| 4057 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); |
| 4058 } |
| 4019 | 4059 |
| 4020 // Push the target function under the receiver. | 4060 // Push the target function under the receiver. |
| 4021 __ push(Operand(esp, 0)); | 4061 __ push(Operand(esp, 0)); |
| 4022 __ mov(Operand(esp, kPointerSize), eax); | 4062 __ mov(Operand(esp, kPointerSize), eax); |
| 4023 | 4063 |
| 4024 // Code common for calls using the IC. | 4064 // Code common for calls using the IC. |
| 4025 ZoneList<Expression*>* args = expr->arguments(); | 4065 ZoneList<Expression*>* args = expr->arguments(); |
| 4026 int arg_count = args->length(); | 4066 int arg_count = args->length(); |
| 4027 for (int i = 0; i < arg_count; i++) { | 4067 for (int i = 0; i < arg_count; i++) { |
| 4028 VisitForStackValue(args->at(i)); | 4068 VisitForStackValue(args->at(i)); |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4356 | 4396 |
| 4357 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { | 4397 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { |
| 4358 VariableProxy* proxy = expr->AsVariableProxy(); | 4398 VariableProxy* proxy = expr->AsVariableProxy(); |
| 4359 ASSERT(!context()->IsEffect()); | 4399 ASSERT(!context()->IsEffect()); |
| 4360 ASSERT(!context()->IsTest()); | 4400 ASSERT(!context()->IsTest()); |
| 4361 | 4401 |
| 4362 if (proxy != NULL && proxy->var()->IsUnallocated()) { | 4402 if (proxy != NULL && proxy->var()->IsUnallocated()) { |
| 4363 Comment cmnt(masm_, "[ Global variable"); | 4403 Comment cmnt(masm_, "[ Global variable"); |
| 4364 __ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand()); | 4404 __ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand()); |
| 4365 __ mov(LoadIC::NameRegister(), Immediate(proxy->name())); | 4405 __ mov(LoadIC::NameRegister(), Immediate(proxy->name())); |
| 4406 if (FLAG_vector_ics) { |
| 4407 __ mov(LoadIC::SlotRegister(), |
| 4408 Immediate(Smi::FromInt(proxy->VariableFeedbackSlot()))); |
| 4409 } |
| 4366 // Use a regular load, not a contextual load, to avoid a reference | 4410 // Use a regular load, not a contextual load, to avoid a reference |
| 4367 // error. | 4411 // error. |
| 4368 CallLoadIC(NOT_CONTEXTUAL); | 4412 CallLoadIC(NOT_CONTEXTUAL); |
| 4369 PrepareForBailout(expr, TOS_REG); | 4413 PrepareForBailout(expr, TOS_REG); |
| 4370 context()->Plug(eax); | 4414 context()->Plug(eax); |
| 4371 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { | 4415 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { |
| 4372 Comment cmnt(masm_, "[ Lookup slot"); | 4416 Comment cmnt(masm_, "[ Lookup slot"); |
| 4373 Label done, slow; | 4417 Label done, slow; |
| 4374 | 4418 |
| 4375 // Generate code for loading from variables potentially shadowed | 4419 // Generate code for loading from variables potentially shadowed |
| 4376 // by eval-introduced variables. | 4420 // by eval-introduced variables. |
| 4377 EmitDynamicLookupFastCase(proxy->var(), INSIDE_TYPEOF, &slow, &done); | 4421 EmitDynamicLookupFastCase(proxy, INSIDE_TYPEOF, &slow, &done); |
| 4378 | 4422 |
| 4379 __ bind(&slow); | 4423 __ bind(&slow); |
| 4380 __ push(esi); | 4424 __ push(esi); |
| 4381 __ push(Immediate(proxy->name())); | 4425 __ push(Immediate(proxy->name())); |
| 4382 __ CallRuntime(Runtime::kLoadLookupSlotNoReferenceError, 2); | 4426 __ CallRuntime(Runtime::kLoadLookupSlotNoReferenceError, 2); |
| 4383 PrepareForBailout(expr, TOS_REG); | 4427 PrepareForBailout(expr, TOS_REG); |
| 4384 __ bind(&done); | 4428 __ bind(&done); |
| 4385 | 4429 |
| 4386 context()->Plug(eax); | 4430 context()->Plug(eax); |
| 4387 } else { | 4431 } else { |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4783 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4827 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 4784 Assembler::target_address_at(call_target_address, | 4828 Assembler::target_address_at(call_target_address, |
| 4785 unoptimized_code)); | 4829 unoptimized_code)); |
| 4786 return OSR_AFTER_STACK_CHECK; | 4830 return OSR_AFTER_STACK_CHECK; |
| 4787 } | 4831 } |
| 4788 | 4832 |
| 4789 | 4833 |
| 4790 } } // namespace v8::internal | 4834 } } // namespace v8::internal |
| 4791 | 4835 |
| 4792 #endif // V8_TARGET_ARCH_X87 | 4836 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |