| 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_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 8 | 8 |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 VisitStatements(clause->statements()); | 1051 VisitStatements(clause->statements()); |
| 1052 } | 1052 } |
| 1053 | 1053 |
| 1054 __ bind(nested_statement.break_label()); | 1054 __ bind(nested_statement.break_label()); |
| 1055 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | 1055 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); |
| 1056 } | 1056 } |
| 1057 | 1057 |
| 1058 | 1058 |
| 1059 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { | 1059 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
| 1060 Comment cmnt(masm_, "[ ForInStatement"); | 1060 Comment cmnt(masm_, "[ ForInStatement"); |
| 1061 int slot = stmt->ForInFeedbackSlot(); | 1061 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); |
| 1062 SetStatementPosition(stmt); | 1062 SetStatementPosition(stmt); |
| 1063 | 1063 |
| 1064 Label loop, exit; | 1064 Label loop, exit; |
| 1065 ForIn loop_statement(this, stmt); | 1065 ForIn loop_statement(this, stmt); |
| 1066 increment_loop_depth(); | 1066 increment_loop_depth(); |
| 1067 | 1067 |
| 1068 // Get the object to enumerate over. If the object is null or undefined, skip | 1068 // Get the object to enumerate over. If the object is null or undefined, skip |
| 1069 // over the loop. See ECMA-262 version 5, section 12.6.4. | 1069 // over the loop. See ECMA-262 version 5, section 12.6.4. |
| 1070 VisitForAccumulatorValue(stmt->enumerable()); | 1070 VisitForAccumulatorValue(stmt->enumerable()); |
| 1071 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); | 1071 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 __ bind(&no_descriptors); | 1142 __ bind(&no_descriptors); |
| 1143 __ addp(rsp, Immediate(kPointerSize)); | 1143 __ addp(rsp, Immediate(kPointerSize)); |
| 1144 __ jmp(&exit); | 1144 __ jmp(&exit); |
| 1145 | 1145 |
| 1146 // We got a fixed array in register rax. Iterate through that. | 1146 // We got a fixed array in register rax. Iterate through that. |
| 1147 Label non_proxy; | 1147 Label non_proxy; |
| 1148 __ bind(&fixed_array); | 1148 __ bind(&fixed_array); |
| 1149 | 1149 |
| 1150 // No need for a write barrier, we are storing a Smi in the feedback vector. | 1150 // No need for a write barrier, we are storing a Smi in the feedback vector. |
| 1151 __ Move(rbx, FeedbackVector()); | 1151 __ Move(rbx, FeedbackVector()); |
| 1152 __ Move(FieldOperand(rbx, FixedArray::OffsetOfElementAt(slot)), | 1152 __ Move(FieldOperand(rbx, FixedArray::OffsetOfElementAt(slot.ToInt())), |
| 1153 TypeFeedbackVector::MegamorphicSentinel(isolate())); | 1153 TypeFeedbackVector::MegamorphicSentinel(isolate())); |
| 1154 __ Move(rbx, Smi::FromInt(1)); // Smi indicates slow check | 1154 __ Move(rbx, Smi::FromInt(1)); // Smi indicates slow check |
| 1155 __ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object | 1155 __ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object |
| 1156 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 1156 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); |
| 1157 __ CmpObjectType(rcx, LAST_JS_PROXY_TYPE, rcx); | 1157 __ CmpObjectType(rcx, LAST_JS_PROXY_TYPE, rcx); |
| 1158 __ j(above, &non_proxy); | 1158 __ j(above, &non_proxy); |
| 1159 __ Move(rbx, Smi::FromInt(0)); // Zero indicates proxy | 1159 __ Move(rbx, Smi::FromInt(0)); // Zero indicates proxy |
| 1160 __ bind(&non_proxy); | 1160 __ bind(&non_proxy); |
| 1161 __ Push(rbx); // Smi | 1161 __ Push(rbx); // Smi |
| 1162 __ Push(rax); // Array | 1162 __ Push(rax); // Array |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1316 Comment cnmt(masm_, "[ SuperReference "); | 1316 Comment cnmt(masm_, "[ SuperReference "); |
| 1317 | 1317 |
| 1318 __ movp(LoadDescriptor::ReceiverRegister(), | 1318 __ movp(LoadDescriptor::ReceiverRegister(), |
| 1319 Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1319 Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1320 | 1320 |
| 1321 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); | 1321 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); |
| 1322 __ Move(LoadDescriptor::NameRegister(), home_object_symbol); | 1322 __ Move(LoadDescriptor::NameRegister(), home_object_symbol); |
| 1323 | 1323 |
| 1324 if (FLAG_vector_ics) { | 1324 if (FLAG_vector_ics) { |
| 1325 __ Move(VectorLoadICDescriptor::SlotRegister(), | 1325 __ Move(VectorLoadICDescriptor::SlotRegister(), |
| 1326 Smi::FromInt(expr->HomeObjectFeedbackSlot())); | 1326 SmiFromSlot(expr->HomeObjectFeedbackSlot())); |
| 1327 CallLoadIC(NOT_CONTEXTUAL); | 1327 CallLoadIC(NOT_CONTEXTUAL); |
| 1328 } else { | 1328 } else { |
| 1329 CallLoadIC(NOT_CONTEXTUAL, expr->HomeObjectFeedbackId()); | 1329 CallLoadIC(NOT_CONTEXTUAL, expr->HomeObjectFeedbackId()); |
| 1330 } | 1330 } |
| 1331 | 1331 |
| 1332 | 1332 |
| 1333 __ Cmp(rax, isolate()->factory()->undefined_value()); | 1333 __ Cmp(rax, isolate()->factory()->undefined_value()); |
| 1334 Label done; | 1334 Label done; |
| 1335 __ j(not_equal, &done); | 1335 __ j(not_equal, &done); |
| 1336 __ CallRuntime(Runtime::kThrowNonMethodError, 0); | 1336 __ CallRuntime(Runtime::kThrowNonMethodError, 0); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1386 __ jmp(&next); | 1386 __ jmp(&next); |
| 1387 __ bind(&fast); | 1387 __ bind(&fast); |
| 1388 } | 1388 } |
| 1389 | 1389 |
| 1390 // All extension objects were empty and it is safe to use a global | 1390 // All extension objects were empty and it is safe to use a global |
| 1391 // load IC call. | 1391 // load IC call. |
| 1392 __ movp(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 1392 __ movp(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
| 1393 __ Move(LoadDescriptor::NameRegister(), proxy->var()->name()); | 1393 __ Move(LoadDescriptor::NameRegister(), proxy->var()->name()); |
| 1394 if (FLAG_vector_ics) { | 1394 if (FLAG_vector_ics) { |
| 1395 __ Move(VectorLoadICDescriptor::SlotRegister(), | 1395 __ Move(VectorLoadICDescriptor::SlotRegister(), |
| 1396 Smi::FromInt(proxy->VariableFeedbackSlot())); | 1396 SmiFromSlot(proxy->VariableFeedbackSlot())); |
| 1397 } | 1397 } |
| 1398 | 1398 |
| 1399 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) | 1399 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) |
| 1400 ? NOT_CONTEXTUAL | 1400 ? NOT_CONTEXTUAL |
| 1401 : CONTEXTUAL; | 1401 : CONTEXTUAL; |
| 1402 CallLoadIC(mode); | 1402 CallLoadIC(mode); |
| 1403 } | 1403 } |
| 1404 | 1404 |
| 1405 | 1405 |
| 1406 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, | 1406 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1472 | 1472 |
| 1473 // Three cases: global variables, lookup variables, and all other types of | 1473 // Three cases: global variables, lookup variables, and all other types of |
| 1474 // variables. | 1474 // variables. |
| 1475 switch (var->location()) { | 1475 switch (var->location()) { |
| 1476 case Variable::UNALLOCATED: { | 1476 case Variable::UNALLOCATED: { |
| 1477 Comment cmnt(masm_, "[ Global variable"); | 1477 Comment cmnt(masm_, "[ Global variable"); |
| 1478 __ Move(LoadDescriptor::NameRegister(), var->name()); | 1478 __ Move(LoadDescriptor::NameRegister(), var->name()); |
| 1479 __ movp(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 1479 __ movp(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
| 1480 if (FLAG_vector_ics) { | 1480 if (FLAG_vector_ics) { |
| 1481 __ Move(VectorLoadICDescriptor::SlotRegister(), | 1481 __ Move(VectorLoadICDescriptor::SlotRegister(), |
| 1482 Smi::FromInt(proxy->VariableFeedbackSlot())); | 1482 SmiFromSlot(proxy->VariableFeedbackSlot())); |
| 1483 } | 1483 } |
| 1484 CallLoadIC(CONTEXTUAL); | 1484 CallLoadIC(CONTEXTUAL); |
| 1485 context()->Plug(rax); | 1485 context()->Plug(rax); |
| 1486 break; | 1486 break; |
| 1487 } | 1487 } |
| 1488 | 1488 |
| 1489 case Variable::PARAMETER: | 1489 case Variable::PARAMETER: |
| 1490 case Variable::LOCAL: | 1490 case Variable::LOCAL: |
| 1491 case Variable::CONTEXT: { | 1491 case Variable::CONTEXT: { |
| 1492 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context slot" | 1492 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context slot" |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2106 __ LoadRoot(load_name, Heap::knext_stringRootIndex); | 2106 __ LoadRoot(load_name, Heap::knext_stringRootIndex); |
| 2107 __ Push(load_name); // "next" | 2107 __ Push(load_name); // "next" |
| 2108 __ Push(Operand(rsp, 2 * kPointerSize)); // iter | 2108 __ Push(Operand(rsp, 2 * kPointerSize)); // iter |
| 2109 __ Push(rax); // received | 2109 __ Push(rax); // received |
| 2110 | 2110 |
| 2111 // result = receiver[f](arg); | 2111 // result = receiver[f](arg); |
| 2112 __ bind(&l_call); | 2112 __ bind(&l_call); |
| 2113 __ movp(load_receiver, Operand(rsp, kPointerSize)); | 2113 __ movp(load_receiver, Operand(rsp, kPointerSize)); |
| 2114 if (FLAG_vector_ics) { | 2114 if (FLAG_vector_ics) { |
| 2115 __ Move(VectorLoadICDescriptor::SlotRegister(), | 2115 __ Move(VectorLoadICDescriptor::SlotRegister(), |
| 2116 Smi::FromInt(expr->KeyedLoadFeedbackSlot())); | 2116 SmiFromSlot(expr->KeyedLoadFeedbackSlot())); |
| 2117 } | 2117 } |
| 2118 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2118 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
| 2119 CallIC(ic, TypeFeedbackId::None()); | 2119 CallIC(ic, TypeFeedbackId::None()); |
| 2120 __ movp(rdi, rax); | 2120 __ movp(rdi, rax); |
| 2121 __ movp(Operand(rsp, 2 * kPointerSize), rdi); | 2121 __ movp(Operand(rsp, 2 * kPointerSize), rdi); |
| 2122 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 2122 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
| 2123 __ CallStub(&stub); | 2123 __ CallStub(&stub); |
| 2124 | 2124 |
| 2125 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 2125 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
| 2126 __ Drop(1); // The function is still on the stack; drop it. | 2126 __ Drop(1); // The function is still on the stack; drop it. |
| 2127 | 2127 |
| 2128 // if (!result.done) goto l_try; | 2128 // if (!result.done) goto l_try; |
| 2129 __ bind(&l_loop); | 2129 __ bind(&l_loop); |
| 2130 __ Move(load_receiver, rax); | 2130 __ Move(load_receiver, rax); |
| 2131 __ Push(load_receiver); // save result | 2131 __ Push(load_receiver); // save result |
| 2132 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" | 2132 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" |
| 2133 if (FLAG_vector_ics) { | 2133 if (FLAG_vector_ics) { |
| 2134 __ Move(VectorLoadICDescriptor::SlotRegister(), | 2134 __ Move(VectorLoadICDescriptor::SlotRegister(), |
| 2135 Smi::FromInt(expr->DoneFeedbackSlot())); | 2135 SmiFromSlot(expr->DoneFeedbackSlot())); |
| 2136 } | 2136 } |
| 2137 CallLoadIC(NOT_CONTEXTUAL); // rax=result.done | 2137 CallLoadIC(NOT_CONTEXTUAL); // rax=result.done |
| 2138 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); | 2138 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); |
| 2139 CallIC(bool_ic); | 2139 CallIC(bool_ic); |
| 2140 __ testp(result_register(), result_register()); | 2140 __ testp(result_register(), result_register()); |
| 2141 __ j(zero, &l_try); | 2141 __ j(zero, &l_try); |
| 2142 | 2142 |
| 2143 // result.value | 2143 // result.value |
| 2144 __ Pop(load_receiver); // result | 2144 __ Pop(load_receiver); // result |
| 2145 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" | 2145 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" |
| 2146 if (FLAG_vector_ics) { | 2146 if (FLAG_vector_ics) { |
| 2147 __ Move(VectorLoadICDescriptor::SlotRegister(), | 2147 __ Move(VectorLoadICDescriptor::SlotRegister(), |
| 2148 Smi::FromInt(expr->ValueFeedbackSlot())); | 2148 SmiFromSlot(expr->ValueFeedbackSlot())); |
| 2149 } | 2149 } |
| 2150 CallLoadIC(NOT_CONTEXTUAL); // result.value in rax | 2150 CallLoadIC(NOT_CONTEXTUAL); // result.value in rax |
| 2151 context()->DropAndPlug(2, rax); // drop iter and g | 2151 context()->DropAndPlug(2, rax); // drop iter and g |
| 2152 break; | 2152 break; |
| 2153 } | 2153 } |
| 2154 } | 2154 } |
| 2155 } | 2155 } |
| 2156 | 2156 |
| 2157 | 2157 |
| 2158 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, | 2158 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2305 | 2305 |
| 2306 | 2306 |
| 2307 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2307 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
| 2308 SetSourcePosition(prop->position()); | 2308 SetSourcePosition(prop->position()); |
| 2309 Literal* key = prop->key()->AsLiteral(); | 2309 Literal* key = prop->key()->AsLiteral(); |
| 2310 DCHECK(!prop->IsSuperAccess()); | 2310 DCHECK(!prop->IsSuperAccess()); |
| 2311 | 2311 |
| 2312 __ Move(LoadDescriptor::NameRegister(), key->value()); | 2312 __ Move(LoadDescriptor::NameRegister(), key->value()); |
| 2313 if (FLAG_vector_ics) { | 2313 if (FLAG_vector_ics) { |
| 2314 __ Move(VectorLoadICDescriptor::SlotRegister(), | 2314 __ Move(VectorLoadICDescriptor::SlotRegister(), |
| 2315 Smi::FromInt(prop->PropertyFeedbackSlot())); | 2315 SmiFromSlot(prop->PropertyFeedbackSlot())); |
| 2316 CallLoadIC(NOT_CONTEXTUAL); | 2316 CallLoadIC(NOT_CONTEXTUAL); |
| 2317 } else { | 2317 } else { |
| 2318 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); | 2318 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); |
| 2319 } | 2319 } |
| 2320 } | 2320 } |
| 2321 | 2321 |
| 2322 | 2322 |
| 2323 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { | 2323 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { |
| 2324 // Stack: receiver, home_object | 2324 // Stack: receiver, home_object |
| 2325 SetSourcePosition(prop->position()); | 2325 SetSourcePosition(prop->position()); |
| 2326 Literal* key = prop->key()->AsLiteral(); | 2326 Literal* key = prop->key()->AsLiteral(); |
| 2327 DCHECK(!key->value()->IsSmi()); | 2327 DCHECK(!key->value()->IsSmi()); |
| 2328 DCHECK(prop->IsSuperAccess()); | 2328 DCHECK(prop->IsSuperAccess()); |
| 2329 | 2329 |
| 2330 __ Push(key->value()); | 2330 __ Push(key->value()); |
| 2331 __ CallRuntime(Runtime::kLoadFromSuper, 3); | 2331 __ CallRuntime(Runtime::kLoadFromSuper, 3); |
| 2332 } | 2332 } |
| 2333 | 2333 |
| 2334 | 2334 |
| 2335 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2335 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
| 2336 SetSourcePosition(prop->position()); | 2336 SetSourcePosition(prop->position()); |
| 2337 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2337 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
| 2338 if (FLAG_vector_ics) { | 2338 if (FLAG_vector_ics) { |
| 2339 __ Move(VectorLoadICDescriptor::SlotRegister(), | 2339 __ Move(VectorLoadICDescriptor::SlotRegister(), |
| 2340 Smi::FromInt(prop->PropertyFeedbackSlot())); | 2340 SmiFromSlot(prop->PropertyFeedbackSlot())); |
| 2341 CallIC(ic); | 2341 CallIC(ic); |
| 2342 } else { | 2342 } else { |
| 2343 CallIC(ic, prop->PropertyFeedbackId()); | 2343 CallIC(ic, prop->PropertyFeedbackId()); |
| 2344 } | 2344 } |
| 2345 } | 2345 } |
| 2346 | 2346 |
| 2347 | 2347 |
| 2348 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { | 2348 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
| 2349 // Stack: receiver, home_object, key. | 2349 // Stack: receiver, home_object, key. |
| 2350 SetSourcePosition(prop->position()); | 2350 SetSourcePosition(prop->position()); |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2791 { PreservePositionScope scope(masm()->positions_recorder()); | 2791 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2792 for (int i = 0; i < arg_count; i++) { | 2792 for (int i = 0; i < arg_count; i++) { |
| 2793 VisitForStackValue(args->at(i)); | 2793 VisitForStackValue(args->at(i)); |
| 2794 } | 2794 } |
| 2795 } | 2795 } |
| 2796 | 2796 |
| 2797 // Record source position of the IC call. | 2797 // Record source position of the IC call. |
| 2798 SetSourcePosition(expr->position()); | 2798 SetSourcePosition(expr->position()); |
| 2799 Handle<Code> ic = CallIC::initialize_stub( | 2799 Handle<Code> ic = CallIC::initialize_stub( |
| 2800 isolate(), arg_count, call_type); | 2800 isolate(), arg_count, call_type); |
| 2801 __ Move(rdx, Smi::FromInt(expr->CallFeedbackSlot())); | 2801 __ Move(rdx, SmiFromSlot(expr->CallFeedbackSlot())); |
| 2802 __ movp(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); | 2802 __ movp(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); |
| 2803 // Don't assign a type feedback id to the IC, since type feedback is provided | 2803 // Don't assign a type feedback id to the IC, since type feedback is provided |
| 2804 // by the vector above. | 2804 // by the vector above. |
| 2805 CallIC(ic); | 2805 CallIC(ic); |
| 2806 | 2806 |
| 2807 RecordJSReturnSite(expr); | 2807 RecordJSReturnSite(expr); |
| 2808 | 2808 |
| 2809 // Restore context register. | 2809 // Restore context register. |
| 2810 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 2810 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
| 2811 // Discard the function left on TOS. | 2811 // Discard the function left on TOS. |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2983 // constructor invocation. | 2983 // constructor invocation. |
| 2984 SetSourcePosition(expr->position()); | 2984 SetSourcePosition(expr->position()); |
| 2985 | 2985 |
| 2986 // Load function and argument count into rdi and rax. | 2986 // Load function and argument count into rdi and rax. |
| 2987 __ Set(rax, arg_count); | 2987 __ Set(rax, arg_count); |
| 2988 __ movp(rdi, Operand(rsp, arg_count * kPointerSize)); | 2988 __ movp(rdi, Operand(rsp, arg_count * kPointerSize)); |
| 2989 | 2989 |
| 2990 // Record call targets in unoptimized code, but not in the snapshot. | 2990 // Record call targets in unoptimized code, but not in the snapshot. |
| 2991 if (FLAG_pretenuring_call_new) { | 2991 if (FLAG_pretenuring_call_new) { |
| 2992 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | 2992 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
| 2993 DCHECK(expr->AllocationSiteFeedbackSlot() == | 2993 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == |
| 2994 expr->CallNewFeedbackSlot() + 1); | 2994 expr->CallNewFeedbackSlot().ToInt() + 1); |
| 2995 } | 2995 } |
| 2996 | 2996 |
| 2997 __ Move(rbx, FeedbackVector()); | 2997 __ Move(rbx, FeedbackVector()); |
| 2998 __ Move(rdx, Smi::FromInt(expr->CallNewFeedbackSlot())); | 2998 __ Move(rdx, SmiFromSlot(expr->CallNewFeedbackSlot())); |
| 2999 | 2999 |
| 3000 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); | 3000 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); |
| 3001 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 3001 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
| 3002 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 3002 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
| 3003 context()->Plug(rax); | 3003 context()->Plug(rax); |
| 3004 } | 3004 } |
| 3005 | 3005 |
| 3006 | 3006 |
| 3007 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 3007 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
| 3008 ZoneList<Expression*>* args = expr->arguments(); | 3008 ZoneList<Expression*>* args = expr->arguments(); |
| (...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4260 if (expr->is_jsruntime()) { | 4260 if (expr->is_jsruntime()) { |
| 4261 // Push the builtins object as receiver. | 4261 // Push the builtins object as receiver. |
| 4262 __ movp(rax, GlobalObjectOperand()); | 4262 __ movp(rax, GlobalObjectOperand()); |
| 4263 __ Push(FieldOperand(rax, GlobalObject::kBuiltinsOffset)); | 4263 __ Push(FieldOperand(rax, GlobalObject::kBuiltinsOffset)); |
| 4264 | 4264 |
| 4265 // Load the function from the receiver. | 4265 // Load the function from the receiver. |
| 4266 __ movp(LoadDescriptor::ReceiverRegister(), Operand(rsp, 0)); | 4266 __ movp(LoadDescriptor::ReceiverRegister(), Operand(rsp, 0)); |
| 4267 __ Move(LoadDescriptor::NameRegister(), expr->name()); | 4267 __ Move(LoadDescriptor::NameRegister(), expr->name()); |
| 4268 if (FLAG_vector_ics) { | 4268 if (FLAG_vector_ics) { |
| 4269 __ Move(VectorLoadICDescriptor::SlotRegister(), | 4269 __ Move(VectorLoadICDescriptor::SlotRegister(), |
| 4270 Smi::FromInt(expr->CallRuntimeFeedbackSlot())); | 4270 SmiFromSlot(expr->CallRuntimeFeedbackSlot())); |
| 4271 CallLoadIC(NOT_CONTEXTUAL); | 4271 CallLoadIC(NOT_CONTEXTUAL); |
| 4272 } else { | 4272 } else { |
| 4273 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); | 4273 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); |
| 4274 } | 4274 } |
| 4275 | 4275 |
| 4276 // Push the target function under the receiver. | 4276 // Push the target function under the receiver. |
| 4277 __ Push(Operand(rsp, 0)); | 4277 __ Push(Operand(rsp, 0)); |
| 4278 __ movp(Operand(rsp, kPointerSize), rax); | 4278 __ movp(Operand(rsp, kPointerSize), rax); |
| 4279 | 4279 |
| 4280 // Push the arguments ("left-to-right"). | 4280 // Push the arguments ("left-to-right"). |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4665 VariableProxy* proxy = expr->AsVariableProxy(); | 4665 VariableProxy* proxy = expr->AsVariableProxy(); |
| 4666 DCHECK(!context()->IsEffect()); | 4666 DCHECK(!context()->IsEffect()); |
| 4667 DCHECK(!context()->IsTest()); | 4667 DCHECK(!context()->IsTest()); |
| 4668 | 4668 |
| 4669 if (proxy != NULL && proxy->var()->IsUnallocated()) { | 4669 if (proxy != NULL && proxy->var()->IsUnallocated()) { |
| 4670 Comment cmnt(masm_, "[ Global variable"); | 4670 Comment cmnt(masm_, "[ Global variable"); |
| 4671 __ Move(LoadDescriptor::NameRegister(), proxy->name()); | 4671 __ Move(LoadDescriptor::NameRegister(), proxy->name()); |
| 4672 __ movp(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 4672 __ movp(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
| 4673 if (FLAG_vector_ics) { | 4673 if (FLAG_vector_ics) { |
| 4674 __ Move(VectorLoadICDescriptor::SlotRegister(), | 4674 __ Move(VectorLoadICDescriptor::SlotRegister(), |
| 4675 Smi::FromInt(proxy->VariableFeedbackSlot())); | 4675 SmiFromSlot(proxy->VariableFeedbackSlot())); |
| 4676 } | 4676 } |
| 4677 // Use a regular load, not a contextual load, to avoid a reference | 4677 // Use a regular load, not a contextual load, to avoid a reference |
| 4678 // error. | 4678 // error. |
| 4679 CallLoadIC(NOT_CONTEXTUAL); | 4679 CallLoadIC(NOT_CONTEXTUAL); |
| 4680 PrepareForBailout(expr, TOS_REG); | 4680 PrepareForBailout(expr, TOS_REG); |
| 4681 context()->Plug(rax); | 4681 context()->Plug(rax); |
| 4682 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { | 4682 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { |
| 4683 Comment cmnt(masm_, "[ Lookup slot"); | 4683 Comment cmnt(masm_, "[ Lookup slot"); |
| 4684 Label done, slow; | 4684 Label done, slow; |
| 4685 | 4685 |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5097 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5097 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 5098 Assembler::target_address_at(call_target_address, | 5098 Assembler::target_address_at(call_target_address, |
| 5099 unoptimized_code)); | 5099 unoptimized_code)); |
| 5100 return OSR_AFTER_STACK_CHECK; | 5100 return OSR_AFTER_STACK_CHECK; |
| 5101 } | 5101 } |
| 5102 | 5102 |
| 5103 | 5103 |
| 5104 } } // namespace v8::internal | 5104 } } // namespace v8::internal |
| 5105 | 5105 |
| 5106 #endif // V8_TARGET_ARCH_X64 | 5106 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |