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

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

Issue 119353: Add instanceof stub for ARM. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 6 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 | « src/arm/macro-assembler-arm.cc ('k') | src/arm/virtual-frame-arm.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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 276
277 void StubCompiler::GenerateLoadArrayLength(MacroAssembler* masm, 277 void StubCompiler::GenerateLoadArrayLength(MacroAssembler* masm,
278 Register receiver, 278 Register receiver,
279 Register scratch, 279 Register scratch,
280 Label* miss_label) { 280 Label* miss_label) {
281 // Check that the receiver isn't a smi. 281 // Check that the receiver isn't a smi.
282 __ tst(receiver, Operand(kSmiTagMask)); 282 __ tst(receiver, Operand(kSmiTagMask));
283 __ b(eq, miss_label); 283 __ b(eq, miss_label);
284 284
285 // Check that the object is a JS array. 285 // Check that the object is a JS array.
286 __ ldr(scratch, FieldMemOperand(receiver, HeapObject::kMapOffset)); 286 __ CompareObjectType(receiver, scratch, scratch, JS_ARRAY_TYPE);
287 __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset));
288 __ cmp(scratch, Operand(JS_ARRAY_TYPE));
289 __ b(ne, miss_label); 287 __ b(ne, miss_label);
290 288
291 // Load length directly from the JS array. 289 // Load length directly from the JS array.
292 __ ldr(r0, FieldMemOperand(receiver, JSArray::kLengthOffset)); 290 __ ldr(r0, FieldMemOperand(receiver, JSArray::kLengthOffset));
293 __ Ret(); 291 __ Ret();
294 } 292 }
295 293
296 294
297 // Generate code to check if an object is a string. If the object is 295 // Generate code to check if an object is a string. If the object is
298 // a string, the map's instance type is left in the scratch1 register. 296 // a string, the map's instance type is left in the scratch1 register.
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 514
517 // Do the right check and compute the holder register. 515 // Do the right check and compute the holder register.
518 Register reg = 516 Register reg =
519 masm()->CheckMaps(JSObject::cast(object), r0, holder, r3, r2, &miss); 517 masm()->CheckMaps(JSObject::cast(object), r0, holder, r3, r2, &miss);
520 GenerateFastPropertyLoad(masm(), r1, reg, holder, index); 518 GenerateFastPropertyLoad(masm(), r1, reg, holder, index);
521 519
522 // Check that the function really is a function. 520 // Check that the function really is a function.
523 __ tst(r1, Operand(kSmiTagMask)); 521 __ tst(r1, Operand(kSmiTagMask));
524 __ b(eq, &miss); 522 __ b(eq, &miss);
525 // Get the map. 523 // Get the map.
526 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); 524 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE);
527 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset));
528 __ cmp(r2, Operand(JS_FUNCTION_TYPE));
529 __ b(ne, &miss); 525 __ b(ne, &miss);
530 526
531 // Patch the receiver on the stack with the global proxy if 527 // Patch the receiver on the stack with the global proxy if
532 // necessary. 528 // necessary.
533 if (object->IsGlobalObject()) { 529 if (object->IsGlobalObject()) {
534 __ ldr(r3, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset)); 530 __ ldr(r3, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset));
535 __ str(r3, MemOperand(sp, argc * kPointerSize)); 531 __ str(r3, MemOperand(sp, argc * kPointerSize));
536 } 532 }
537 533
538 // Invoke the function. 534 // Invoke the function.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 // Patch the receiver on the stack with the global proxy if 577 // Patch the receiver on the stack with the global proxy if
582 // necessary. 578 // necessary.
583 if (object->IsGlobalObject()) { 579 if (object->IsGlobalObject()) {
584 __ ldr(r3, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); 580 __ ldr(r3, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset));
585 __ str(r3, MemOperand(sp, argc * kPointerSize)); 581 __ str(r3, MemOperand(sp, argc * kPointerSize));
586 } 582 }
587 break; 583 break;
588 584
589 case STRING_CHECK: 585 case STRING_CHECK:
590 // Check that the object is a two-byte string or a symbol. 586 // Check that the object is a two-byte string or a symbol.
591 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); 587 __ CompareObjectType(r1, r2, r2, FIRST_NONSTRING_TYPE);
592 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset));
593 __ cmp(r2, Operand(FIRST_NONSTRING_TYPE));
594 __ b(hs, &miss); 588 __ b(hs, &miss);
595 // Check that the maps starting from the prototype haven't changed. 589 // Check that the maps starting from the prototype haven't changed.
596 GenerateLoadGlobalFunctionPrototype(masm(), 590 GenerateLoadGlobalFunctionPrototype(masm(),
597 Context::STRING_FUNCTION_INDEX, 591 Context::STRING_FUNCTION_INDEX,
598 r2); 592 r2);
599 __ CheckMaps(JSObject::cast(object->GetPrototype()), 593 __ CheckMaps(JSObject::cast(object->GetPrototype()),
600 r2, holder, r3, r1, &miss); 594 r2, holder, r3, r1, &miss);
601 break; 595 break;
602 596
603 case NUMBER_CHECK: { 597 case NUMBER_CHECK: {
604 Label fast; 598 Label fast;
605 // Check that the object is a smi or a heap number. 599 // Check that the object is a smi or a heap number.
606 __ tst(r1, Operand(kSmiTagMask)); 600 __ tst(r1, Operand(kSmiTagMask));
607 __ b(eq, &fast); 601 __ b(eq, &fast);
608 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); 602 __ CompareObjectType(r1, r2, r2, HEAP_NUMBER_TYPE);
609 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset));
610 __ cmp(r2, Operand(HEAP_NUMBER_TYPE));
611 __ b(ne, &miss); 603 __ b(ne, &miss);
612 __ bind(&fast); 604 __ bind(&fast);
613 // Check that the maps starting from the prototype haven't changed. 605 // Check that the maps starting from the prototype haven't changed.
614 GenerateLoadGlobalFunctionPrototype(masm(), 606 GenerateLoadGlobalFunctionPrototype(masm(),
615 Context::NUMBER_FUNCTION_INDEX, 607 Context::NUMBER_FUNCTION_INDEX,
616 r2); 608 r2);
617 __ CheckMaps(JSObject::cast(object->GetPrototype()), 609 __ CheckMaps(JSObject::cast(object->GetPrototype()),
618 r2, holder, r3, r1, &miss); 610 r2, holder, r3, r1, &miss);
619 break; 611 break;
620 } 612 }
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 __ Jump(ic, RelocInfo::CODE_TARGET); 1131 __ Jump(ic, RelocInfo::CODE_TARGET);
1140 1132
1141 // Return the generated code. 1133 // Return the generated code.
1142 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); 1134 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name);
1143 } 1135 }
1144 1136
1145 1137
1146 #undef __ 1138 #undef __
1147 1139
1148 } } // namespace v8::internal 1140 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/arm/virtual-frame-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698