Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: src/arm/stub-cache-arm.cc

Issue 3462001: Bring r5483 "Fix direct loading of global function prototypes" to 2.3. (Closed) Base URL: http://v8.googlecode.com/svn/branches/2.3/
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 1381
1377 const int argc = arguments().immediate(); 1382 const int argc = arguments().immediate();
1378 1383
1379 Label miss; 1384 Label miss;
1380 Label index_out_of_range; 1385 Label index_out_of_range;
1381 GenerateNameCheck(name, &miss); 1386 GenerateNameCheck(name, &miss);
1382 1387
1383 // Check that the maps starting from the prototype haven't changed. 1388 // Check that the maps starting from the prototype haven't changed.
1384 GenerateDirectLoadGlobalFunctionPrototype(masm(), 1389 GenerateDirectLoadGlobalFunctionPrototype(masm(),
1385 Context::STRING_FUNCTION_INDEX, 1390 Context::STRING_FUNCTION_INDEX,
1386 r0); 1391 r0,
1392 &miss);
1387 ASSERT(object != holder); 1393 ASSERT(object != holder);
1388 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder, 1394 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder,
1389 r1, r3, r4, name, &miss); 1395 r1, r3, r4, name, &miss);
1390 1396
1391 Register receiver = r1; 1397 Register receiver = r1;
1392 Register index = r4; 1398 Register index = r4;
1393 Register scratch = r3; 1399 Register scratch = r3;
1394 Register result = r0; 1400 Register result = r0;
1395 __ ldr(receiver, MemOperand(sp, argc * kPointerSize)); 1401 __ ldr(receiver, MemOperand(sp, argc * kPointerSize));
1396 if (argc > 0) { 1402 if (argc > 0) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1447 const int argc = arguments().immediate(); 1453 const int argc = arguments().immediate();
1448 1454
1449 Label miss; 1455 Label miss;
1450 Label index_out_of_range; 1456 Label index_out_of_range;
1451 1457
1452 GenerateNameCheck(name, &miss); 1458 GenerateNameCheck(name, &miss);
1453 1459
1454 // Check that the maps starting from the prototype haven't changed. 1460 // Check that the maps starting from the prototype haven't changed.
1455 GenerateDirectLoadGlobalFunctionPrototype(masm(), 1461 GenerateDirectLoadGlobalFunctionPrototype(masm(),
1456 Context::STRING_FUNCTION_INDEX, 1462 Context::STRING_FUNCTION_INDEX,
1457 r0); 1463 r0,
1464 &miss);
1458 ASSERT(object != holder); 1465 ASSERT(object != holder);
1459 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder, 1466 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder,
1460 r1, r3, r4, name, &miss); 1467 r1, r3, r4, name, &miss);
1461 1468
1462 Register receiver = r0; 1469 Register receiver = r0;
1463 Register index = r4; 1470 Register index = r4;
1464 Register scratch1 = r1; 1471 Register scratch1 = r1;
1465 Register scratch2 = r3; 1472 Register scratch2 = r3;
1466 Register result = r0; 1473 Register result = r0;
1467 __ ldr(receiver, MemOperand(sp, argc * kPointerSize)); 1474 __ ldr(receiver, MemOperand(sp, argc * kPointerSize));
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1573 case STRING_CHECK: 1580 case STRING_CHECK:
1574 if (!function->IsBuiltin()) { 1581 if (!function->IsBuiltin()) {
1575 // Calling non-builtins with a value as receiver requires boxing. 1582 // Calling non-builtins with a value as receiver requires boxing.
1576 __ jmp(&miss); 1583 __ jmp(&miss);
1577 } else { 1584 } else {
1578 // Check that the object is a two-byte string or a symbol. 1585 // Check that the object is a two-byte string or a symbol.
1579 __ CompareObjectType(r1, r3, r3, FIRST_NONSTRING_TYPE); 1586 __ CompareObjectType(r1, r3, r3, FIRST_NONSTRING_TYPE);
1580 __ b(hs, &miss); 1587 __ b(hs, &miss);
1581 // Check that the maps starting from the prototype haven't changed. 1588 // Check that the maps starting from the prototype haven't changed.
1582 GenerateDirectLoadGlobalFunctionPrototype( 1589 GenerateDirectLoadGlobalFunctionPrototype(
1583 masm(), Context::STRING_FUNCTION_INDEX, r0); 1590 masm(), Context::STRING_FUNCTION_INDEX, r0, &miss);
1584 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder, r3, 1591 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder, r3,
1585 r1, r4, name, &miss); 1592 r1, r4, name, &miss);
1586 } 1593 }
1587 break; 1594 break;
1588 1595
1589 case NUMBER_CHECK: { 1596 case NUMBER_CHECK: {
1590 if (!function->IsBuiltin()) { 1597 if (!function->IsBuiltin()) {
1591 // Calling non-builtins with a value as receiver requires boxing. 1598 // Calling non-builtins with a value as receiver requires boxing.
1592 __ jmp(&miss); 1599 __ jmp(&miss);
1593 } else { 1600 } else {
1594 Label fast; 1601 Label fast;
1595 // Check that the object is a smi or a heap number. 1602 // Check that the object is a smi or a heap number.
1596 __ tst(r1, Operand(kSmiTagMask)); 1603 __ tst(r1, Operand(kSmiTagMask));
1597 __ b(eq, &fast); 1604 __ b(eq, &fast);
1598 __ CompareObjectType(r1, r0, r0, HEAP_NUMBER_TYPE); 1605 __ CompareObjectType(r1, r0, r0, HEAP_NUMBER_TYPE);
1599 __ b(ne, &miss); 1606 __ b(ne, &miss);
1600 __ bind(&fast); 1607 __ bind(&fast);
1601 // Check that the maps starting from the prototype haven't changed. 1608 // Check that the maps starting from the prototype haven't changed.
1602 GenerateDirectLoadGlobalFunctionPrototype( 1609 GenerateDirectLoadGlobalFunctionPrototype(
1603 masm(), Context::NUMBER_FUNCTION_INDEX, r0); 1610 masm(), Context::NUMBER_FUNCTION_INDEX, r0, &miss);
1604 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder, r3, 1611 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder, r3,
1605 r1, r4, name, &miss); 1612 r1, r4, name, &miss);
1606 } 1613 }
1607 break; 1614 break;
1608 } 1615 }
1609 1616
1610 case BOOLEAN_CHECK: { 1617 case BOOLEAN_CHECK: {
1611 if (!function->IsBuiltin()) { 1618 if (!function->IsBuiltin()) {
1612 // Calling non-builtins with a value as receiver requires boxing. 1619 // Calling non-builtins with a value as receiver requires boxing.
1613 __ jmp(&miss); 1620 __ jmp(&miss);
1614 } else { 1621 } else {
1615 Label fast; 1622 Label fast;
1616 // Check that the object is a boolean. 1623 // Check that the object is a boolean.
1617 __ LoadRoot(ip, Heap::kTrueValueRootIndex); 1624 __ LoadRoot(ip, Heap::kTrueValueRootIndex);
1618 __ cmp(r1, ip); 1625 __ cmp(r1, ip);
1619 __ b(eq, &fast); 1626 __ b(eq, &fast);
1620 __ LoadRoot(ip, Heap::kFalseValueRootIndex); 1627 __ LoadRoot(ip, Heap::kFalseValueRootIndex);
1621 __ cmp(r1, ip); 1628 __ cmp(r1, ip);
1622 __ b(ne, &miss); 1629 __ b(ne, &miss);
1623 __ bind(&fast); 1630 __ bind(&fast);
1624 // Check that the maps starting from the prototype haven't changed. 1631 // Check that the maps starting from the prototype haven't changed.
1625 GenerateDirectLoadGlobalFunctionPrototype( 1632 GenerateDirectLoadGlobalFunctionPrototype(
1626 masm(), Context::BOOLEAN_FUNCTION_INDEX, r0); 1633 masm(), Context::BOOLEAN_FUNCTION_INDEX, r0, &miss);
1627 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder, r3, 1634 CheckPrototypes(JSObject::cast(object->GetPrototype()), r0, holder, r3,
1628 r1, r4, name, &miss); 1635 r1, r4, name, &miss);
1629 } 1636 }
1630 break; 1637 break;
1631 } 1638 }
1632 1639
1633 default: 1640 default:
1634 UNREACHABLE(); 1641 UNREACHABLE();
1635 } 1642 }
1636 1643
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
2467 // Return the generated code. 2474 // Return the generated code.
2468 return GetCode(); 2475 return GetCode();
2469 } 2476 }
2470 2477
2471 2478
2472 #undef __ 2479 #undef __
2473 2480
2474 } } // namespace v8::internal 2481 } } // namespace v8::internal
2475 2482
2476 #endif // V8_TARGET_ARCH_ARM 2483 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698