OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 | 1245 |
1246 | 1246 |
1247 void CallStubCompiler::GenerateNameCheck(String* name, Label* miss) { | 1247 void CallStubCompiler::GenerateNameCheck(String* name, Label* miss) { |
1248 if (kind_ == Code::KEYED_CALL_IC) { | 1248 if (kind_ == Code::KEYED_CALL_IC) { |
1249 __ cmp(r2, Operand(Handle<String>(name))); | 1249 __ cmp(r2, Operand(Handle<String>(name))); |
1250 __ b(ne, miss); | 1250 __ b(ne, miss); |
1251 } | 1251 } |
1252 } | 1252 } |
1253 | 1253 |
1254 | 1254 |
1255 void CallStubCompiler::GenerateMissBranch() { | 1255 Object* CallStubCompiler::GenerateMissBranch() { |
1256 Handle<Code> ic = ComputeCallMiss(arguments().immediate(), kind_); | 1256 Object* obj = StubCache::ComputeCallMiss(arguments().immediate(), kind_); |
1257 __ Jump(ic, RelocInfo::CODE_TARGET); | 1257 if (obj->IsFailure()) return obj; |
| 1258 __ Jump(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); |
| 1259 return obj; |
1258 } | 1260 } |
1259 | 1261 |
1260 | 1262 |
1261 Object* CallStubCompiler::CompileCallField(JSObject* object, | 1263 Object* CallStubCompiler::CompileCallField(JSObject* object, |
1262 JSObject* holder, | 1264 JSObject* holder, |
1263 int index, | 1265 int index, |
1264 String* name) { | 1266 String* name) { |
1265 // ----------- S t a t e ------------- | 1267 // ----------- S t a t e ------------- |
1266 // -- r2 : name | 1268 // -- r2 : name |
1267 // -- lr : return address | 1269 // -- lr : return address |
(...skipping 11 matching lines...) Expand all Loading... |
1279 __ b(eq, &miss); | 1281 __ b(eq, &miss); |
1280 | 1282 |
1281 // Do the right check and compute the holder register. | 1283 // Do the right check and compute the holder register. |
1282 Register reg = CheckPrototypes(object, r0, holder, r1, r3, r4, name, &miss); | 1284 Register reg = CheckPrototypes(object, r0, holder, r1, r3, r4, name, &miss); |
1283 GenerateFastPropertyLoad(masm(), r1, reg, holder, index); | 1285 GenerateFastPropertyLoad(masm(), r1, reg, holder, index); |
1284 | 1286 |
1285 GenerateCallFunction(masm(), object, arguments(), &miss); | 1287 GenerateCallFunction(masm(), object, arguments(), &miss); |
1286 | 1288 |
1287 // Handle call cache miss. | 1289 // Handle call cache miss. |
1288 __ bind(&miss); | 1290 __ bind(&miss); |
1289 GenerateMissBranch(); | 1291 Object* obj = GenerateMissBranch(); |
| 1292 if (obj->IsFailure()) return obj; |
1290 | 1293 |
1291 // Return the generated code. | 1294 // Return the generated code. |
1292 return GetCode(FIELD, name); | 1295 return GetCode(FIELD, name); |
1293 } | 1296 } |
1294 | 1297 |
1295 | 1298 |
1296 Object* CallStubCompiler::CompileArrayPushCall(Object* object, | 1299 Object* CallStubCompiler::CompileArrayPushCall(Object* object, |
1297 JSObject* holder, | 1300 JSObject* holder, |
1298 JSFunction* function, | 1301 JSFunction* function, |
1299 String* name, | 1302 String* name, |
(...skipping 30 matching lines...) Expand all Loading... |
1330 __ ldr(r3, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); | 1333 __ ldr(r3, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); |
1331 __ str(r3, MemOperand(sp, argc * kPointerSize)); | 1334 __ str(r3, MemOperand(sp, argc * kPointerSize)); |
1332 } | 1335 } |
1333 | 1336 |
1334 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), | 1337 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), |
1335 argc + 1, | 1338 argc + 1, |
1336 1); | 1339 1); |
1337 | 1340 |
1338 // Handle call cache miss. | 1341 // Handle call cache miss. |
1339 __ bind(&miss); | 1342 __ bind(&miss); |
1340 GenerateMissBranch(); | 1343 Object* obj = GenerateMissBranch(); |
| 1344 if (obj->IsFailure()) return obj; |
1341 | 1345 |
1342 // Return the generated code. | 1346 // Return the generated code. |
1343 return GetCode(function); | 1347 return GetCode(function); |
1344 } | 1348 } |
1345 | 1349 |
1346 | 1350 |
1347 Object* CallStubCompiler::CompileArrayPopCall(Object* object, | 1351 Object* CallStubCompiler::CompileArrayPopCall(Object* object, |
1348 JSObject* holder, | 1352 JSObject* holder, |
1349 JSFunction* function, | 1353 JSFunction* function, |
1350 String* name, | 1354 String* name, |
(...skipping 30 matching lines...) Expand all Loading... |
1381 __ ldr(r3, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); | 1385 __ ldr(r3, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); |
1382 __ str(r3, MemOperand(sp, argc * kPointerSize)); | 1386 __ str(r3, MemOperand(sp, argc * kPointerSize)); |
1383 } | 1387 } |
1384 | 1388 |
1385 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), | 1389 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), |
1386 argc + 1, | 1390 argc + 1, |
1387 1); | 1391 1); |
1388 | 1392 |
1389 // Handle call cache miss. | 1393 // Handle call cache miss. |
1390 __ bind(&miss); | 1394 __ bind(&miss); |
1391 GenerateMissBranch(); | 1395 Object* obj = GenerateMissBranch(); |
| 1396 if (obj->IsFailure()) return obj; |
1392 | 1397 |
1393 // Return the generated code. | 1398 // Return the generated code. |
1394 return GetCode(function); | 1399 return GetCode(function); |
1395 } | 1400 } |
1396 | 1401 |
1397 | 1402 |
1398 Object* CallStubCompiler::CompileStringCharCodeAtCall(Object* object, | 1403 Object* CallStubCompiler::CompileStringCharCodeAtCall(Object* object, |
1399 JSObject* holder, | 1404 JSObject* holder, |
1400 JSFunction* function, | 1405 JSFunction* function, |
1401 String* name, | 1406 String* name, |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1554 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); | 1559 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); |
1555 } | 1560 } |
1556 | 1561 |
1557 // Handle call cache miss. | 1562 // Handle call cache miss. |
1558 __ bind(&miss); | 1563 __ bind(&miss); |
1559 if (depth != kInvalidProtoDepth) { | 1564 if (depth != kInvalidProtoDepth) { |
1560 FreeSpaceForFastApiCall(masm()); | 1565 FreeSpaceForFastApiCall(masm()); |
1561 } | 1566 } |
1562 | 1567 |
1563 __ bind(&miss_in_smi_check); | 1568 __ bind(&miss_in_smi_check); |
1564 GenerateMissBranch(); | 1569 Object* obj = GenerateMissBranch(); |
| 1570 if (obj->IsFailure()) return obj; |
1565 | 1571 |
1566 // Return the generated code. | 1572 // Return the generated code. |
1567 return GetCode(function); | 1573 return GetCode(function); |
1568 } | 1574 } |
1569 | 1575 |
1570 | 1576 |
1571 Object* CallStubCompiler::CompileCallInterceptor(JSObject* object, | 1577 Object* CallStubCompiler::CompileCallInterceptor(JSObject* object, |
1572 JSObject* holder, | 1578 JSObject* holder, |
1573 String* name) { | 1579 String* name) { |
1574 // ----------- S t a t e ------------- | 1580 // ----------- S t a t e ------------- |
(...skipping 28 matching lines...) Expand all Loading... |
1603 | 1609 |
1604 // Move returned value, the function to call, to r1. | 1610 // Move returned value, the function to call, to r1. |
1605 __ mov(r1, r0); | 1611 __ mov(r1, r0); |
1606 // Restore receiver. | 1612 // Restore receiver. |
1607 __ ldr(r0, MemOperand(sp, argc * kPointerSize)); | 1613 __ ldr(r0, MemOperand(sp, argc * kPointerSize)); |
1608 | 1614 |
1609 GenerateCallFunction(masm(), object, arguments(), &miss); | 1615 GenerateCallFunction(masm(), object, arguments(), &miss); |
1610 | 1616 |
1611 // Handle call cache miss. | 1617 // Handle call cache miss. |
1612 __ bind(&miss); | 1618 __ bind(&miss); |
1613 GenerateMissBranch(); | 1619 Object* obj = GenerateMissBranch(); |
| 1620 if (obj->IsFailure()) return obj; |
1614 | 1621 |
1615 // Return the generated code. | 1622 // Return the generated code. |
1616 return GetCode(INTERCEPTOR, name); | 1623 return GetCode(INTERCEPTOR, name); |
1617 } | 1624 } |
1618 | 1625 |
1619 | 1626 |
1620 Object* CallStubCompiler::CompileCallGlobal(JSObject* object, | 1627 Object* CallStubCompiler::CompileCallGlobal(JSObject* object, |
1621 GlobalObject* holder, | 1628 GlobalObject* holder, |
1622 JSGlobalPropertyCell* cell, | 1629 JSGlobalPropertyCell* cell, |
1623 JSFunction* function, | 1630 JSFunction* function, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1687 __ IncrementCounter(&Counters::call_global_inline, 1, r3, r4); | 1694 __ IncrementCounter(&Counters::call_global_inline, 1, r3, r4); |
1688 ASSERT(function->is_compiled()); | 1695 ASSERT(function->is_compiled()); |
1689 Handle<Code> code(function->code()); | 1696 Handle<Code> code(function->code()); |
1690 ParameterCount expected(function->shared()->formal_parameter_count()); | 1697 ParameterCount expected(function->shared()->formal_parameter_count()); |
1691 __ InvokeCode(code, expected, arguments(), | 1698 __ InvokeCode(code, expected, arguments(), |
1692 RelocInfo::CODE_TARGET, JUMP_FUNCTION); | 1699 RelocInfo::CODE_TARGET, JUMP_FUNCTION); |
1693 | 1700 |
1694 // Handle call cache miss. | 1701 // Handle call cache miss. |
1695 __ bind(&miss); | 1702 __ bind(&miss); |
1696 __ IncrementCounter(&Counters::call_global_inline_miss, 1, r1, r3); | 1703 __ IncrementCounter(&Counters::call_global_inline_miss, 1, r1, r3); |
1697 GenerateMissBranch(); | 1704 Object* obj = GenerateMissBranch(); |
| 1705 if (obj->IsFailure()) return obj; |
1698 | 1706 |
1699 // Return the generated code. | 1707 // Return the generated code. |
1700 return GetCode(NORMAL, name); | 1708 return GetCode(NORMAL, name); |
1701 } | 1709 } |
1702 | 1710 |
1703 | 1711 |
1704 Object* StoreStubCompiler::CompileStoreField(JSObject* object, | 1712 Object* StoreStubCompiler::CompileStoreField(JSObject* object, |
1705 int index, | 1713 int index, |
1706 Map* transition, | 1714 Map* transition, |
1707 String* name) { | 1715 String* name) { |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2378 // Return the generated code. | 2386 // Return the generated code. |
2379 return GetCode(); | 2387 return GetCode(); |
2380 } | 2388 } |
2381 | 2389 |
2382 | 2390 |
2383 #undef __ | 2391 #undef __ |
2384 | 2392 |
2385 } } // namespace v8::internal | 2393 } } // namespace v8::internal |
2386 | 2394 |
2387 #endif // V8_TARGET_ARCH_ARM | 2395 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |