| 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 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/ic-inl.h" | 10 #include "src/ic-inl.h" |
| (...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 FrameScope scope(masm, StackFrame::INTERNAL); | 1188 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1189 | 1189 |
| 1190 // Save value register, so we can restore it later. | 1190 // Save value register, so we can restore it later. |
| 1191 __ push(value()); | 1191 __ push(value()); |
| 1192 | 1192 |
| 1193 if (!setter.is_null()) { | 1193 if (!setter.is_null()) { |
| 1194 // Call the JavaScript setter with receiver and value on the stack. | 1194 // Call the JavaScript setter with receiver and value on the stack. |
| 1195 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { | 1195 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
| 1196 // Swap in the global receiver. | 1196 // Swap in the global receiver. |
| 1197 __ lw(receiver, | 1197 __ lw(receiver, |
| 1198 FieldMemOperand( | 1198 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
| 1199 receiver, JSGlobalObject::kGlobalReceiverOffset)); | |
| 1200 } | 1199 } |
| 1201 __ Push(receiver, value()); | 1200 __ Push(receiver, value()); |
| 1202 ParameterCount actual(1); | 1201 ParameterCount actual(1); |
| 1203 ParameterCount expected(setter); | 1202 ParameterCount expected(setter); |
| 1204 __ InvokeFunction(setter, expected, actual, | 1203 __ InvokeFunction(setter, expected, actual, |
| 1205 CALL_FUNCTION, NullCallWrapper()); | 1204 CALL_FUNCTION, NullCallWrapper()); |
| 1206 } else { | 1205 } else { |
| 1207 // If we generate a global code snippet for deoptimization only, remember | 1206 // If we generate a global code snippet for deoptimization only, remember |
| 1208 // the place to continue after deoptimization. | 1207 // the place to continue after deoptimization. |
| 1209 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); | 1208 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1249 | 1248 |
| 1250 // Return the generated code. | 1249 // Return the generated code. |
| 1251 return GetCode(kind(), Code::FAST, name); | 1250 return GetCode(kind(), Code::FAST, name); |
| 1252 } | 1251 } |
| 1253 | 1252 |
| 1254 | 1253 |
| 1255 Register* LoadStubCompiler::registers() { | 1254 Register* LoadStubCompiler::registers() { |
| 1256 // receiver, name, scratch1, scratch2, scratch3, scratch4. | 1255 // receiver, name, scratch1, scratch2, scratch3, scratch4. |
| 1257 Register receiver = LoadIC::ReceiverRegister(); | 1256 Register receiver = LoadIC::ReceiverRegister(); |
| 1258 Register name = LoadIC::NameRegister(); | 1257 Register name = LoadIC::NameRegister(); |
| 1259 static Register registers[] = { receiver, name, a3, a1, t0, t1 }; | 1258 static Register registers[] = { receiver, name, a3, a0, t0, t1 }; |
| 1260 return registers; | 1259 return registers; |
| 1261 } | 1260 } |
| 1262 | 1261 |
| 1263 | 1262 |
| 1264 Register* KeyedLoadStubCompiler::registers() { | 1263 Register* KeyedLoadStubCompiler::registers() { |
| 1265 // receiver, name, scratch1, scratch2, scratch3, scratch4. | 1264 // receiver, name, scratch1, scratch2, scratch3, scratch4. |
| 1266 Register receiver = KeyedLoadIC::ReceiverRegister(); | 1265 Register receiver = LoadIC::ReceiverRegister(); |
| 1267 Register name = KeyedLoadIC::NameRegister(); | 1266 Register name = LoadIC::NameRegister(); |
| 1268 static Register registers[] = { receiver, name, a2, a3, t0, t1 }; | 1267 static Register registers[] = { receiver, name, a3, a0, t0, t1 }; |
| 1269 return registers; | 1268 return registers; |
| 1270 } | 1269 } |
| 1271 | 1270 |
| 1272 | 1271 |
| 1273 Register StoreStubCompiler::value() { | 1272 Register StoreStubCompiler::value() { |
| 1274 return a0; | 1273 return a0; |
| 1275 } | 1274 } |
| 1276 | 1275 |
| 1277 | 1276 |
| 1278 Register* StoreStubCompiler::registers() { | 1277 Register* StoreStubCompiler::registers() { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1303 // -- ra : return address | 1302 // -- ra : return address |
| 1304 // ----------------------------------- | 1303 // ----------------------------------- |
| 1305 { | 1304 { |
| 1306 FrameScope scope(masm, StackFrame::INTERNAL); | 1305 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1307 | 1306 |
| 1308 if (!getter.is_null()) { | 1307 if (!getter.is_null()) { |
| 1309 // Call the JavaScript getter with the receiver on the stack. | 1308 // Call the JavaScript getter with the receiver on the stack. |
| 1310 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { | 1309 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
| 1311 // Swap in the global receiver. | 1310 // Swap in the global receiver. |
| 1312 __ lw(receiver, | 1311 __ lw(receiver, |
| 1313 FieldMemOperand( | 1312 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
| 1314 receiver, JSGlobalObject::kGlobalReceiverOffset)); | |
| 1315 } | 1313 } |
| 1316 __ push(receiver); | 1314 __ push(receiver); |
| 1317 ParameterCount actual(0); | 1315 ParameterCount actual(0); |
| 1318 ParameterCount expected(getter); | 1316 ParameterCount expected(getter); |
| 1319 __ InvokeFunction(getter, expected, actual, | 1317 __ InvokeFunction(getter, expected, actual, |
| 1320 CALL_FUNCTION, NullCallWrapper()); | 1318 CALL_FUNCTION, NullCallWrapper()); |
| 1321 } else { | 1319 } else { |
| 1322 // If we generate a global code snippet for deoptimization only, remember | 1320 // If we generate a global code snippet for deoptimization only, remember |
| 1323 // the place to continue after deoptimization. | 1321 // the place to continue after deoptimization. |
| 1324 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); | 1322 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1459 kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC); | 1457 kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC); |
| 1460 } | 1458 } |
| 1461 | 1459 |
| 1462 | 1460 |
| 1463 #undef __ | 1461 #undef __ |
| 1464 #define __ ACCESS_MASM(masm) | 1462 #define __ ACCESS_MASM(masm) |
| 1465 | 1463 |
| 1466 | 1464 |
| 1467 void KeyedLoadStubCompiler::GenerateLoadDictionaryElement( | 1465 void KeyedLoadStubCompiler::GenerateLoadDictionaryElement( |
| 1468 MacroAssembler* masm) { | 1466 MacroAssembler* masm) { |
| 1469 // ---------- S t a t e -------------- | 1467 // The return address is in ra. |
| 1470 // -- ra : return address | |
| 1471 // -- a0 : key | |
| 1472 // -- a1 : receiver | |
| 1473 // ----------------------------------- | |
| 1474 ASSERT(a1.is(KeyedLoadIC::ReceiverRegister())); | |
| 1475 ASSERT(a0.is(KeyedLoadIC::NameRegister())); | |
| 1476 Label slow, miss; | 1468 Label slow, miss; |
| 1477 | 1469 |
| 1478 Register key = a0; | 1470 Register key = LoadIC::NameRegister(); |
| 1479 Register receiver = a1; | 1471 Register receiver = LoadIC::ReceiverRegister(); |
| 1472 ASSERT(receiver.is(a1)); |
| 1473 ASSERT(key.is(a2)); |
| 1480 | 1474 |
| 1481 __ JumpIfNotSmi(key, &miss); | 1475 __ UntagAndJumpIfNotSmi(t2, key, &miss); |
| 1482 __ lw(t0, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 1476 __ lw(t0, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
| 1483 __ sra(a2, a0, kSmiTagSize); | 1477 __ LoadFromNumberDictionary(&slow, t0, key, v0, t2, a3, t1); |
| 1484 __ LoadFromNumberDictionary(&slow, t0, a0, v0, a2, a3, t1); | |
| 1485 __ Ret(); | 1478 __ Ret(); |
| 1486 | 1479 |
| 1487 // Slow case, key and receiver still in a0 and a1. | 1480 // Slow case, key and receiver still unmodified. |
| 1488 __ bind(&slow); | 1481 __ bind(&slow); |
| 1489 __ IncrementCounter( | 1482 __ IncrementCounter( |
| 1490 masm->isolate()->counters()->keyed_load_external_array_slow(), | 1483 masm->isolate()->counters()->keyed_load_external_array_slow(), |
| 1491 1, a2, a3); | 1484 1, a2, a3); |
| 1492 // Entry registers are intact. | 1485 |
| 1493 // ---------- S t a t e -------------- | |
| 1494 // -- ra : return address | |
| 1495 // -- a0 : key | |
| 1496 // -- a1 : receiver | |
| 1497 // ----------------------------------- | |
| 1498 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Slow); | 1486 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Slow); |
| 1499 | 1487 |
| 1500 // Miss case, call the runtime. | 1488 // Miss case, call the runtime. |
| 1501 __ bind(&miss); | 1489 __ bind(&miss); |
| 1502 | 1490 |
| 1503 // ---------- S t a t e -------------- | |
| 1504 // -- ra : return address | |
| 1505 // -- a0 : key | |
| 1506 // -- a1 : receiver | |
| 1507 // ----------------------------------- | |
| 1508 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1491 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 1509 } | 1492 } |
| 1510 | 1493 |
| 1511 | 1494 |
| 1512 #undef __ | 1495 #undef __ |
| 1513 | 1496 |
| 1514 } } // namespace v8::internal | 1497 } } // namespace v8::internal |
| 1515 | 1498 |
| 1516 #endif // V8_TARGET_ARCH_MIPS | 1499 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |