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