| 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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
| 8 | 8 |
| 9 // Note on Mips implementation: | 9 // Note on Mips implementation: |
| 10 // | 10 // |
| (...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1312 | 1312 |
| 1313 void FullCodeGenerator::EmitLoadHomeObject(SuperReference* expr) { | 1313 void FullCodeGenerator::EmitLoadHomeObject(SuperReference* expr) { |
| 1314 Comment cnmt(masm_, "[ SuperReference "); | 1314 Comment cnmt(masm_, "[ SuperReference "); |
| 1315 | 1315 |
| 1316 __ ld(LoadDescriptor::ReceiverRegister(), | 1316 __ ld(LoadDescriptor::ReceiverRegister(), |
| 1317 MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1317 MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1318 | 1318 |
| 1319 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); | 1319 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); |
| 1320 __ li(LoadDescriptor::NameRegister(), home_object_symbol); | 1320 __ li(LoadDescriptor::NameRegister(), home_object_symbol); |
| 1321 | 1321 |
| 1322 __ li(VectorLoadICDescriptor::SlotRegister(), | 1322 __ li(LoadDescriptor::SlotRegister(), |
| 1323 Operand(SmiFromSlot(expr->HomeObjectFeedbackSlot()))); | 1323 Operand(SmiFromSlot(expr->HomeObjectFeedbackSlot()))); |
| 1324 CallLoadIC(NOT_CONTEXTUAL); | 1324 CallLoadIC(NOT_CONTEXTUAL); |
| 1325 | 1325 |
| 1326 Label done; | 1326 Label done; |
| 1327 __ Branch(&done, ne, v0, Operand(isolate()->factory()->undefined_value())); | 1327 __ Branch(&done, ne, v0, Operand(isolate()->factory()->undefined_value())); |
| 1328 __ CallRuntime(Runtime::kThrowNonMethodError, 0); | 1328 __ CallRuntime(Runtime::kThrowNonMethodError, 0); |
| 1329 __ bind(&done); | 1329 __ bind(&done); |
| 1330 } | 1330 } |
| 1331 | 1331 |
| 1332 | 1332 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1383 __ ld(temp, ContextOperand(next, Context::EXTENSION_INDEX)); | 1383 __ ld(temp, ContextOperand(next, Context::EXTENSION_INDEX)); |
| 1384 __ Branch(slow, ne, temp, Operand(zero_reg)); | 1384 __ Branch(slow, ne, temp, Operand(zero_reg)); |
| 1385 // Load next context in chain. | 1385 // Load next context in chain. |
| 1386 __ ld(next, ContextOperand(next, Context::PREVIOUS_INDEX)); | 1386 __ ld(next, ContextOperand(next, Context::PREVIOUS_INDEX)); |
| 1387 __ Branch(&loop); | 1387 __ Branch(&loop); |
| 1388 __ bind(&fast); | 1388 __ bind(&fast); |
| 1389 } | 1389 } |
| 1390 | 1390 |
| 1391 __ ld(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 1391 __ ld(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
| 1392 __ li(LoadDescriptor::NameRegister(), Operand(proxy->var()->name())); | 1392 __ li(LoadDescriptor::NameRegister(), Operand(proxy->var()->name())); |
| 1393 __ li(VectorLoadICDescriptor::SlotRegister(), | 1393 __ li(LoadDescriptor::SlotRegister(), |
| 1394 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); | 1394 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
| 1395 | 1395 |
| 1396 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) | 1396 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) |
| 1397 ? NOT_CONTEXTUAL | 1397 ? NOT_CONTEXTUAL |
| 1398 : CONTEXTUAL; | 1398 : CONTEXTUAL; |
| 1399 CallLoadIC(mode); | 1399 CallLoadIC(mode); |
| 1400 } | 1400 } |
| 1401 | 1401 |
| 1402 | 1402 |
| 1403 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, | 1403 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1473 | 1473 |
| 1474 // Three cases: global variables, lookup variables, and all other types of | 1474 // Three cases: global variables, lookup variables, and all other types of |
| 1475 // variables. | 1475 // variables. |
| 1476 switch (var->location()) { | 1476 switch (var->location()) { |
| 1477 case Variable::UNALLOCATED: { | 1477 case Variable::UNALLOCATED: { |
| 1478 Comment cmnt(masm_, "[ Global variable"); | 1478 Comment cmnt(masm_, "[ Global variable"); |
| 1479 // Use inline caching. Variable name is passed in a2 and the global | 1479 // Use inline caching. Variable name is passed in a2 and the global |
| 1480 // object (receiver) in a0. | 1480 // object (receiver) in a0. |
| 1481 __ ld(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 1481 __ ld(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
| 1482 __ li(LoadDescriptor::NameRegister(), Operand(var->name())); | 1482 __ li(LoadDescriptor::NameRegister(), Operand(var->name())); |
| 1483 __ li(VectorLoadICDescriptor::SlotRegister(), | 1483 __ li(LoadDescriptor::SlotRegister(), |
| 1484 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); | 1484 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
| 1485 CallGlobalLoadIC(var->name()); | 1485 CallGlobalLoadIC(var->name()); |
| 1486 context()->Plug(v0); | 1486 context()->Plug(v0); |
| 1487 break; | 1487 break; |
| 1488 } | 1488 } |
| 1489 | 1489 |
| 1490 case Variable::PARAMETER: | 1490 case Variable::PARAMETER: |
| 1491 case Variable::LOCAL: | 1491 case Variable::LOCAL: |
| 1492 case Variable::CONTEXT: { | 1492 case Variable::CONTEXT: { |
| 1493 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" | 1493 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2169 // receiver = iter; f = 'next'; arg = received; | 2169 // receiver = iter; f = 'next'; arg = received; |
| 2170 __ bind(&l_next); | 2170 __ bind(&l_next); |
| 2171 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" | 2171 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" |
| 2172 __ ld(a3, MemOperand(sp, 1 * kPointerSize)); // iter | 2172 __ ld(a3, MemOperand(sp, 1 * kPointerSize)); // iter |
| 2173 __ Push(load_name, a3, a0); // "next", iter, received | 2173 __ Push(load_name, a3, a0); // "next", iter, received |
| 2174 | 2174 |
| 2175 // result = receiver[f](arg); | 2175 // result = receiver[f](arg); |
| 2176 __ bind(&l_call); | 2176 __ bind(&l_call); |
| 2177 __ ld(load_receiver, MemOperand(sp, kPointerSize)); | 2177 __ ld(load_receiver, MemOperand(sp, kPointerSize)); |
| 2178 __ ld(load_name, MemOperand(sp, 2 * kPointerSize)); | 2178 __ ld(load_name, MemOperand(sp, 2 * kPointerSize)); |
| 2179 __ li(VectorLoadICDescriptor::SlotRegister(), | 2179 __ li(LoadDescriptor::SlotRegister(), |
| 2180 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); | 2180 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); |
| 2181 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2181 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
| 2182 CallIC(ic, TypeFeedbackId::None()); | 2182 CallIC(ic, TypeFeedbackId::None()); |
| 2183 __ mov(a0, v0); | 2183 __ mov(a0, v0); |
| 2184 __ mov(a1, a0); | 2184 __ mov(a1, a0); |
| 2185 __ sd(a1, MemOperand(sp, 2 * kPointerSize)); | 2185 __ sd(a1, MemOperand(sp, 2 * kPointerSize)); |
| 2186 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 2186 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
| 2187 __ CallStub(&stub); | 2187 __ CallStub(&stub); |
| 2188 | 2188 |
| 2189 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2189 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2190 __ Drop(1); // The function is still on the stack; drop it. | 2190 __ Drop(1); // The function is still on the stack; drop it. |
| 2191 | 2191 |
| 2192 // if (!result.done) goto l_try; | 2192 // if (!result.done) goto l_try; |
| 2193 __ Move(load_receiver, v0); | 2193 __ Move(load_receiver, v0); |
| 2194 | 2194 |
| 2195 __ push(load_receiver); // save result | 2195 __ push(load_receiver); // save result |
| 2196 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" | 2196 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" |
| 2197 __ li(VectorLoadICDescriptor::SlotRegister(), | 2197 __ li(LoadDescriptor::SlotRegister(), |
| 2198 Operand(SmiFromSlot(expr->DoneFeedbackSlot()))); | 2198 Operand(SmiFromSlot(expr->DoneFeedbackSlot()))); |
| 2199 CallLoadIC(NOT_CONTEXTUAL); // v0=result.done | 2199 CallLoadIC(NOT_CONTEXTUAL); // v0=result.done |
| 2200 __ mov(a0, v0); | 2200 __ mov(a0, v0); |
| 2201 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); | 2201 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); |
| 2202 CallIC(bool_ic); | 2202 CallIC(bool_ic); |
| 2203 __ Branch(&l_try, eq, v0, Operand(zero_reg)); | 2203 __ Branch(&l_try, eq, v0, Operand(zero_reg)); |
| 2204 | 2204 |
| 2205 // result.value | 2205 // result.value |
| 2206 __ pop(load_receiver); // result | 2206 __ pop(load_receiver); // result |
| 2207 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" | 2207 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" |
| 2208 __ li(VectorLoadICDescriptor::SlotRegister(), | 2208 __ li(LoadDescriptor::SlotRegister(), |
| 2209 Operand(SmiFromSlot(expr->ValueFeedbackSlot()))); | 2209 Operand(SmiFromSlot(expr->ValueFeedbackSlot()))); |
| 2210 CallLoadIC(NOT_CONTEXTUAL); // v0=result.value | 2210 CallLoadIC(NOT_CONTEXTUAL); // v0=result.value |
| 2211 context()->DropAndPlug(2, v0); // drop iter and g | 2211 context()->DropAndPlug(2, v0); // drop iter and g |
| 2212 break; | 2212 break; |
| 2213 } | 2213 } |
| 2214 } | 2214 } |
| 2215 } | 2215 } |
| 2216 | 2216 |
| 2217 | 2217 |
| 2218 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, | 2218 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2342 a2, a3, kRAHasBeenSaved, kDontSaveFPRegs); | 2342 a2, a3, kRAHasBeenSaved, kDontSaveFPRegs); |
| 2343 } | 2343 } |
| 2344 | 2344 |
| 2345 | 2345 |
| 2346 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2346 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
| 2347 SetSourcePosition(prop->position()); | 2347 SetSourcePosition(prop->position()); |
| 2348 Literal* key = prop->key()->AsLiteral(); | 2348 Literal* key = prop->key()->AsLiteral(); |
| 2349 DCHECK(!prop->IsSuperAccess()); | 2349 DCHECK(!prop->IsSuperAccess()); |
| 2350 | 2350 |
| 2351 __ li(LoadDescriptor::NameRegister(), Operand(key->value())); | 2351 __ li(LoadDescriptor::NameRegister(), Operand(key->value())); |
| 2352 __ li(VectorLoadICDescriptor::SlotRegister(), | 2352 __ li(LoadDescriptor::SlotRegister(), |
| 2353 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); | 2353 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); |
| 2354 CallLoadIC(NOT_CONTEXTUAL); | 2354 CallLoadIC(NOT_CONTEXTUAL); |
| 2355 } | 2355 } |
| 2356 | 2356 |
| 2357 | 2357 |
| 2358 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { | 2358 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { |
| 2359 // Stack: receiver, home_object. | 2359 // Stack: receiver, home_object. |
| 2360 SetSourcePosition(prop->position()); | 2360 SetSourcePosition(prop->position()); |
| 2361 Literal* key = prop->key()->AsLiteral(); | 2361 Literal* key = prop->key()->AsLiteral(); |
| 2362 DCHECK(!key->value()->IsSmi()); | 2362 DCHECK(!key->value()->IsSmi()); |
| 2363 DCHECK(prop->IsSuperAccess()); | 2363 DCHECK(prop->IsSuperAccess()); |
| 2364 | 2364 |
| 2365 __ Push(key->value()); | 2365 __ Push(key->value()); |
| 2366 __ CallRuntime(Runtime::kLoadFromSuper, 3); | 2366 __ CallRuntime(Runtime::kLoadFromSuper, 3); |
| 2367 } | 2367 } |
| 2368 | 2368 |
| 2369 | 2369 |
| 2370 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2370 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
| 2371 SetSourcePosition(prop->position()); | 2371 SetSourcePosition(prop->position()); |
| 2372 // Call keyed load IC. It has register arguments receiver and key. | 2372 // Call keyed load IC. It has register arguments receiver and key. |
| 2373 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2373 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
| 2374 __ li(VectorLoadICDescriptor::SlotRegister(), | 2374 __ li(LoadDescriptor::SlotRegister(), |
| 2375 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); | 2375 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); |
| 2376 CallIC(ic); | 2376 CallIC(ic); |
| 2377 } | 2377 } |
| 2378 | 2378 |
| 2379 | 2379 |
| 2380 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { | 2380 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
| 2381 // Stack: receiver, home_object, key. | 2381 // Stack: receiver, home_object, key. |
| 2382 SetSourcePosition(prop->position()); | 2382 SetSourcePosition(prop->position()); |
| 2383 | 2383 |
| 2384 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); | 2384 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
| (...skipping 2226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4611 | 4611 |
| 4612 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { | 4612 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { |
| 4613 // Push the builtins object as the receiver. | 4613 // Push the builtins object as the receiver. |
| 4614 Register receiver = LoadDescriptor::ReceiverRegister(); | 4614 Register receiver = LoadDescriptor::ReceiverRegister(); |
| 4615 __ ld(receiver, GlobalObjectOperand()); | 4615 __ ld(receiver, GlobalObjectOperand()); |
| 4616 __ ld(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset)); | 4616 __ ld(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset)); |
| 4617 __ push(receiver); | 4617 __ push(receiver); |
| 4618 | 4618 |
| 4619 // Load the function from the receiver. | 4619 // Load the function from the receiver. |
| 4620 __ li(LoadDescriptor::NameRegister(), Operand(expr->name())); | 4620 __ li(LoadDescriptor::NameRegister(), Operand(expr->name())); |
| 4621 __ li(VectorLoadICDescriptor::SlotRegister(), | 4621 __ li(LoadDescriptor::SlotRegister(), |
| 4622 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); | 4622 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); |
| 4623 CallLoadIC(NOT_CONTEXTUAL); | 4623 CallLoadIC(NOT_CONTEXTUAL); |
| 4624 } | 4624 } |
| 4625 | 4625 |
| 4626 | 4626 |
| 4627 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 4627 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
| 4628 ZoneList<Expression*>* args = expr->arguments(); | 4628 ZoneList<Expression*>* args = expr->arguments(); |
| 4629 int arg_count = args->length(); | 4629 int arg_count = args->length(); |
| 4630 | 4630 |
| 4631 // Record source position of the IC call. | 4631 // Record source position of the IC call. |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5047 | 5047 |
| 5048 | 5048 |
| 5049 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { | 5049 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { |
| 5050 DCHECK(!context()->IsEffect()); | 5050 DCHECK(!context()->IsEffect()); |
| 5051 DCHECK(!context()->IsTest()); | 5051 DCHECK(!context()->IsTest()); |
| 5052 VariableProxy* proxy = expr->AsVariableProxy(); | 5052 VariableProxy* proxy = expr->AsVariableProxy(); |
| 5053 if (proxy != NULL && proxy->var()->IsUnallocated()) { | 5053 if (proxy != NULL && proxy->var()->IsUnallocated()) { |
| 5054 Comment cmnt(masm_, "[ Global variable"); | 5054 Comment cmnt(masm_, "[ Global variable"); |
| 5055 __ ld(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 5055 __ ld(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
| 5056 __ li(LoadDescriptor::NameRegister(), Operand(proxy->name())); | 5056 __ li(LoadDescriptor::NameRegister(), Operand(proxy->name())); |
| 5057 __ li(VectorLoadICDescriptor::SlotRegister(), | 5057 __ li(LoadDescriptor::SlotRegister(), |
| 5058 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); | 5058 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
| 5059 // Use a regular load, not a contextual load, to avoid a reference | 5059 // Use a regular load, not a contextual load, to avoid a reference |
| 5060 // error. | 5060 // error. |
| 5061 CallLoadIC(NOT_CONTEXTUAL); | 5061 CallLoadIC(NOT_CONTEXTUAL); |
| 5062 PrepareForBailout(expr, TOS_REG); | 5062 PrepareForBailout(expr, TOS_REG); |
| 5063 context()->Plug(v0); | 5063 context()->Plug(v0); |
| 5064 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { | 5064 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { |
| 5065 Comment cmnt(masm_, "[ Lookup slot"); | 5065 Comment cmnt(masm_, "[ Lookup slot"); |
| 5066 Label done, slow; | 5066 Label done, slow; |
| 5067 | 5067 |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5430 Assembler::target_address_at(pc_immediate_load_address)) == | 5430 Assembler::target_address_at(pc_immediate_load_address)) == |
| 5431 reinterpret_cast<uint64_t>( | 5431 reinterpret_cast<uint64_t>( |
| 5432 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5432 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 5433 return OSR_AFTER_STACK_CHECK; | 5433 return OSR_AFTER_STACK_CHECK; |
| 5434 } | 5434 } |
| 5435 | 5435 |
| 5436 | 5436 |
| 5437 } } // namespace v8::internal | 5437 } } // namespace v8::internal |
| 5438 | 5438 |
| 5439 #endif // V8_TARGET_ARCH_MIPS64 | 5439 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |