| 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 __ ldr(prototype, MemOperand(prototype, Context::SlotOffset(index))); | 259 __ ldr(prototype, MemOperand(prototype, Context::SlotOffset(index))); |
| 260 // Load the initial map. The global functions all have initial maps. | 260 // Load the initial map. The global functions all have initial maps. |
| 261 __ ldr(prototype, | 261 __ ldr(prototype, |
| 262 FieldMemOperand(prototype, JSFunction::kPrototypeOrInitialMapOffset)); | 262 FieldMemOperand(prototype, JSFunction::kPrototypeOrInitialMapOffset)); |
| 263 // Load the prototype from the initial map. | 263 // Load the prototype from the initial map. |
| 264 __ ldr(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset)); | 264 __ ldr(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset)); |
| 265 } | 265 } |
| 266 | 266 |
| 267 | 267 |
| 268 void StubCompiler::GenerateDirectLoadGlobalFunctionPrototype( | 268 void StubCompiler::GenerateDirectLoadGlobalFunctionPrototype( |
| 269 MacroAssembler* masm, int index, Register prototype) { | 269 MacroAssembler* masm, int index, Register prototype, Label* miss) { |
| 270 // Check we're still in the same context. |
| 271 __ ldr(prototype, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 272 __ Move(ip, Top::global()); |
| 273 __ cmp(prototype, ip); |
| 274 __ b(ne, miss); |
| 270 // Get the global function with the given index. | 275 // Get the global function with the given index. |
| 271 JSFunction* function = JSFunction::cast(Top::global_context()->get(index)); | 276 JSFunction* function = JSFunction::cast(Top::global_context()->get(index)); |
| 272 // Load its initial map. The global functions all have initial maps. | 277 // Load its initial map. The global functions all have initial maps. |
| 273 __ Move(prototype, Handle<Map>(function->initial_map())); | 278 __ Move(prototype, Handle<Map>(function->initial_map())); |
| 274 // Load the prototype from the initial map. | 279 // Load the prototype from the initial map. |
| 275 __ ldr(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset)); | 280 __ ldr(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset)); |
| 276 } | 281 } |
| 277 | 282 |
| 278 | 283 |
| 279 // Load a fast property out of a holder object (src). In-object properties | 284 // Load a fast property out of a holder object (src). In-object properties |
| (...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1487 case STRING_CHECK: | 1492 case STRING_CHECK: |
| 1488 if (!function->IsBuiltin()) { | 1493 if (!function->IsBuiltin()) { |
| 1489 // Calling non-builtins with a value as receiver requires boxing. | 1494 // Calling non-builtins with a value as receiver requires boxing. |
| 1490 __ jmp(&miss); | 1495 __ jmp(&miss); |
| 1491 } else { | 1496 } else { |
| 1492 // Check that the object is a two-byte string or a symbol. | 1497 // Check that the object is a two-byte string or a symbol. |
| 1493 __ CompareObjectType(r1, r3, r3, FIRST_NONSTRING_TYPE); | 1498 __ CompareObjectType(r1, r3, r3, FIRST_NONSTRING_TYPE); |
| 1494 __ b(hs, &miss); | 1499 __ b(hs, &miss); |
| 1495 // Check that the maps starting from the prototype haven't changed. | 1500 // Check that the maps starting from the prototype haven't changed. |
| 1496 GenerateDirectLoadGlobalFunctionPrototype( | 1501 GenerateDirectLoadGlobalFunctionPrototype( |
| 1497 masm(), Context::STRING_FUNCTION_INDEX, r0); | 1502 masm(), Context::STRING_FUNCTION_INDEX, r0, &miss); |
| 1498 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder, r3, | 1503 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder, r3, |
| 1499 r1, r4, name, &miss); | 1504 r1, r4, name, &miss); |
| 1500 } | 1505 } |
| 1501 break; | 1506 break; |
| 1502 | 1507 |
| 1503 case NUMBER_CHECK: { | 1508 case NUMBER_CHECK: { |
| 1504 if (!function->IsBuiltin()) { | 1509 if (!function->IsBuiltin()) { |
| 1505 // Calling non-builtins with a value as receiver requires boxing. | 1510 // Calling non-builtins with a value as receiver requires boxing. |
| 1506 __ jmp(&miss); | 1511 __ jmp(&miss); |
| 1507 } else { | 1512 } else { |
| 1508 Label fast; | 1513 Label fast; |
| 1509 // Check that the object is a smi or a heap number. | 1514 // Check that the object is a smi or a heap number. |
| 1510 __ tst(r1, Operand(kSmiTagMask)); | 1515 __ tst(r1, Operand(kSmiTagMask)); |
| 1511 __ b(eq, &fast); | 1516 __ b(eq, &fast); |
| 1512 __ CompareObjectType(r1, r0, r0, HEAP_NUMBER_TYPE); | 1517 __ CompareObjectType(r1, r0, r0, HEAP_NUMBER_TYPE); |
| 1513 __ b(ne, &miss); | 1518 __ b(ne, &miss); |
| 1514 __ bind(&fast); | 1519 __ bind(&fast); |
| 1515 // Check that the maps starting from the prototype haven't changed. | 1520 // Check that the maps starting from the prototype haven't changed. |
| 1516 GenerateDirectLoadGlobalFunctionPrototype( | 1521 GenerateDirectLoadGlobalFunctionPrototype( |
| 1517 masm(), Context::NUMBER_FUNCTION_INDEX, r0); | 1522 masm(), Context::NUMBER_FUNCTION_INDEX, r0, &miss); |
| 1518 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder, r3, | 1523 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder, r3, |
| 1519 r1, r4, name, &miss); | 1524 r1, r4, name, &miss); |
| 1520 } | 1525 } |
| 1521 break; | 1526 break; |
| 1522 } | 1527 } |
| 1523 | 1528 |
| 1524 case BOOLEAN_CHECK: { | 1529 case BOOLEAN_CHECK: { |
| 1525 if (!function->IsBuiltin()) { | 1530 if (!function->IsBuiltin()) { |
| 1526 // Calling non-builtins with a value as receiver requires boxing. | 1531 // Calling non-builtins with a value as receiver requires boxing. |
| 1527 __ jmp(&miss); | 1532 __ jmp(&miss); |
| 1528 } else { | 1533 } else { |
| 1529 Label fast; | 1534 Label fast; |
| 1530 // Check that the object is a boolean. | 1535 // Check that the object is a boolean. |
| 1531 __ LoadRoot(ip, Heap::kTrueValueRootIndex); | 1536 __ LoadRoot(ip, Heap::kTrueValueRootIndex); |
| 1532 __ cmp(r1, ip); | 1537 __ cmp(r1, ip); |
| 1533 __ b(eq, &fast); | 1538 __ b(eq, &fast); |
| 1534 __ LoadRoot(ip, Heap::kFalseValueRootIndex); | 1539 __ LoadRoot(ip, Heap::kFalseValueRootIndex); |
| 1535 __ cmp(r1, ip); | 1540 __ cmp(r1, ip); |
| 1536 __ b(ne, &miss); | 1541 __ b(ne, &miss); |
| 1537 __ bind(&fast); | 1542 __ bind(&fast); |
| 1538 // Check that the maps starting from the prototype haven't changed. | 1543 // Check that the maps starting from the prototype haven't changed. |
| 1539 GenerateDirectLoadGlobalFunctionPrototype( | 1544 GenerateDirectLoadGlobalFunctionPrototype( |
| 1540 masm(), Context::BOOLEAN_FUNCTION_INDEX, r0); | 1545 masm(), Context::BOOLEAN_FUNCTION_INDEX, r0, &miss); |
| 1541 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder, r3, | 1546 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder, r3, |
| 1542 r1, r4, name, &miss); | 1547 r1, r4, name, &miss); |
| 1543 } | 1548 } |
| 1544 break; | 1549 break; |
| 1545 } | 1550 } |
| 1546 | 1551 |
| 1547 default: | 1552 default: |
| 1548 UNREACHABLE(); | 1553 UNREACHABLE(); |
| 1549 } | 1554 } |
| 1550 | 1555 |
| (...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2378 // Return the generated code. | 2383 // Return the generated code. |
| 2379 return GetCode(); | 2384 return GetCode(); |
| 2380 } | 2385 } |
| 2381 | 2386 |
| 2382 | 2387 |
| 2383 #undef __ | 2388 #undef __ |
| 2384 | 2389 |
| 2385 } } // namespace v8::internal | 2390 } } // namespace v8::internal |
| 2386 | 2391 |
| 2387 #endif // V8_TARGET_ARCH_ARM | 2392 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |