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

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

Issue 6894003: Better support for 'polymorphic' JS and external arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: new strategy Created 9 years, 8 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/builtins.h » ('j') | src/ia32/stub-cache-ia32.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 3110 matching lines...) Expand 10 before | Expand all | Expand 10 after
3121 3121
3122 GenerateLoadFunctionPrototype(masm(), r1, r2, r3, &miss); 3122 GenerateLoadFunctionPrototype(masm(), r1, r2, r3, &miss);
3123 __ bind(&miss); 3123 __ bind(&miss);
3124 __ DecrementCounter(counters->keyed_load_function_prototype(), 1, r2, r3); 3124 __ DecrementCounter(counters->keyed_load_function_prototype(), 1, r2, r3);
3125 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 3125 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
3126 3126
3127 return GetCode(CALLBACKS, name); 3127 return GetCode(CALLBACKS, name);
3128 } 3128 }
3129 3129
3130 3130
3131 MaybeObject* KeyedLoadStubCompiler::CompileLoadSpecialized(JSObject* receiver) { 3131 MaybeObject* KeyedLoadStubCompiler::CompileLoadSpecialized(
3132 JSObject* receiver,
3133 ZoneMapList* receiver_maps) {
3132 // ----------- S t a t e ------------- 3134 // ----------- S t a t e -------------
3133 // -- lr : return address 3135 // -- lr : return address
3134 // -- r0 : key 3136 // -- r0 : key
3135 // -- r1 : receiver 3137 // -- r1 : receiver
3136 // ----------------------------------- 3138 // -----------------------------------
3137 Label miss; 3139 Label miss;
3138 3140
3139 // Check that the receiver isn't a smi. 3141 // Check that the receiver isn't a smi.
3140 __ tst(r1, Operand(kSmiTagMask)); 3142 __ tst(r1, Operand(kSmiTagMask));
3141 __ b(eq, &miss); 3143 __ b(eq, &miss);
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
3450 3452
3451 MaybeObject* ExternalArrayStubCompiler::CompileKeyedLoadStub( 3453 MaybeObject* ExternalArrayStubCompiler::CompileKeyedLoadStub(
3452 JSObject* receiver_object, 3454 JSObject* receiver_object,
3453 ExternalArrayType array_type, 3455 ExternalArrayType array_type,
3454 Code::Flags flags) { 3456 Code::Flags flags) {
3455 // ---------- S t a t e -------------- 3457 // ---------- S t a t e --------------
3456 // -- lr : return address 3458 // -- lr : return address
3457 // -- r0 : key 3459 // -- r0 : key
3458 // -- r1 : receiver 3460 // -- r1 : receiver
3459 // ----------------------------------- 3461 // -----------------------------------
3460 Label slow, failed_allocation; 3462 Label slow, failed_allocation, miss;
3461 3463
3462 Register key = r0; 3464 Register key = r0;
3463 Register receiver = r1; 3465 Register receiver = r1;
3464 3466
3465 // Check that the object isn't a smi 3467 // Check that the object isn't a smi
3466 __ JumpIfSmi(receiver, &slow); 3468 __ JumpIfSmi(receiver, &miss);
3467 3469
3468 // Check that the key is a smi. 3470 // Check that the key is a smi.
3469 __ JumpIfNotSmi(key, &slow); 3471 __ JumpIfNotSmi(key, &miss);
3470 3472
3471 // Make sure that we've got the right map. 3473 // Make sure that we've got the right map.
3472 __ ldr(r2, FieldMemOperand(receiver, HeapObject::kMapOffset)); 3474 __ ldr(r2, FieldMemOperand(receiver, HeapObject::kMapOffset));
3473 __ cmp(r2, Operand(Handle<Map>(receiver_object->map()))); 3475 __ cmp(r2, Operand(Handle<Map>(receiver_object->map())));
3474 __ b(ne, &slow); 3476 __ b(ne, &miss);
3475 3477
3476 __ ldr(r3, FieldMemOperand(receiver, JSObject::kElementsOffset)); 3478 __ ldr(r3, FieldMemOperand(receiver, JSObject::kElementsOffset));
3477 // r3: elements array 3479 // r3: elements array
3478 3480
3479 // Check that the index is in range. 3481 // Check that the index is in range.
3480 __ ldr(ip, FieldMemOperand(r3, ExternalArray::kLengthOffset)); 3482 __ ldr(ip, FieldMemOperand(r3, ExternalArray::kLengthOffset));
3481 __ cmp(ip, Operand(key, ASR, kSmiTagSize)); 3483 __ cmp(ip, Operand(key, ASR, kSmiTagSize));
3482 // Unsigned comparison catches both negative and too-large values. 3484 // Unsigned comparison catches both negative and too-large values.
3483 __ b(lo, &slow); 3485 __ b(lo, &miss);
3484 3486
3485 __ ldr(r3, FieldMemOperand(r3, ExternalArray::kExternalPointerOffset)); 3487 __ ldr(r3, FieldMemOperand(r3, ExternalArray::kExternalPointerOffset));
3486 // r3: base pointer of external storage 3488 // r3: base pointer of external storage
3487 3489
3488 // We are not untagging smi key and instead work with it 3490 // We are not untagging smi key and instead work with it
3489 // as if it was premultiplied by 2. 3491 // as if it was premultiplied by 2.
3490 ASSERT((kSmiTag == 0) && (kSmiTagSize == 1)); 3492 ASSERT((kSmiTag == 0) && (kSmiTagSize == 1));
3491 3493
3492 Register value = r2; 3494 Register value = r2;
3493 switch (array_type) { 3495 switch (array_type) {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
3746 __ IncrementCounter( 3748 __ IncrementCounter(
3747 masm()->isolate()->counters()->keyed_load_external_array_slow(), 3749 masm()->isolate()->counters()->keyed_load_external_array_slow(),
3748 1, r2, r3); 3750 1, r2, r3);
3749 3751
3750 // ---------- S t a t e -------------- 3752 // ---------- S t a t e --------------
3751 // -- lr : return address 3753 // -- lr : return address
3752 // -- r0 : key 3754 // -- r0 : key
3753 // -- r1 : receiver 3755 // -- r1 : receiver
3754 // ----------------------------------- 3756 // -----------------------------------
3755 3757
3756 __ Push(r1, r0); 3758 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Slow();
3759 __ Jump(ic, RelocInfo::CODE_TARGET);
3757 3760
3758 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); 3761 // Slow case: Jump to runtime.
3762 __ bind(&miss);
3763 // ----------- S t a t e -------------
3764 // -- lr : return address
3765 // -- r0 : key
3766 // -- r1 : receiver
3767 // -----------------------------------
3768
3769 Handle<Code> miss_ic = isolate()->builtins()->KeyedLoadIC_Miss();
3770 __ Jump(miss_ic, RelocInfo::CODE_TARGET);
3759 3771
3760 return GetCode(flags); 3772 return GetCode(flags);
3761 } 3773 }
3762 3774
3763 3775
3764 MaybeObject* ExternalArrayStubCompiler::CompileKeyedStoreStub( 3776 MaybeObject* ExternalArrayStubCompiler::CompileKeyedStoreStub(
3765 JSObject* receiver_object, 3777 JSObject* receiver_object,
3766 ExternalArrayType array_type, 3778 ExternalArrayType array_type,
3767 Code::Flags flags) { 3779 Code::Flags flags) {
3768 // ---------- S t a t e -------------- 3780 // ---------- S t a t e --------------
3769 // -- r0 : value 3781 // -- r0 : value
3770 // -- r1 : key 3782 // -- r1 : key
3771 // -- r2 : receiver 3783 // -- r2 : receiver
3772 // -- lr : return address 3784 // -- lr : return address
3773 // ----------------------------------- 3785 // -----------------------------------
3774 Label slow, check_heap_number; 3786 Label slow, check_heap_number, miss;
3775 3787
3776 // Register usage. 3788 // Register usage.
3777 Register value = r0; 3789 Register value = r0;
3778 Register key = r1; 3790 Register key = r1;
3779 Register receiver = r2; 3791 Register receiver = r2;
3780 // r3 mostly holds the elements array or the destination external array. 3792 // r3 mostly holds the elements array or the destination external array.
3781 3793
3782 // Check that the object isn't a smi. 3794 // Check that the object isn't a smi.
3783 __ JumpIfSmi(receiver, &slow); 3795 __ JumpIfSmi(receiver, &miss);
3784 3796
3785 // Make sure that we've got the right map. 3797 // Make sure that we've got the right map.
3786 __ ldr(r3, FieldMemOperand(receiver, HeapObject::kMapOffset)); 3798 __ ldr(r3, FieldMemOperand(receiver, HeapObject::kMapOffset));
3787 __ cmp(r3, Operand(Handle<Map>(receiver_object->map()))); 3799 __ cmp(r3, Operand(Handle<Map>(receiver_object->map())));
3788 __ b(ne, &slow); 3800 __ b(ne, &miss);
3789 3801
3790 __ ldr(r3, FieldMemOperand(receiver, JSObject::kElementsOffset)); 3802 __ ldr(r3, FieldMemOperand(receiver, JSObject::kElementsOffset));
3791 3803
3792 // Check that the key is a smi. 3804 // Check that the key is a smi.
3793 __ JumpIfNotSmi(key, &slow); 3805 __ JumpIfNotSmi(key, &miss);
3794 3806
3795 // Check that the index is in range 3807 // Check that the index is in range
3796 __ SmiUntag(r4, key); 3808 __ SmiUntag(r4, key);
3797 __ ldr(ip, FieldMemOperand(r3, ExternalArray::kLengthOffset)); 3809 __ ldr(ip, FieldMemOperand(r3, ExternalArray::kLengthOffset));
3798 __ cmp(r4, ip); 3810 __ cmp(r4, ip);
3799 // Unsigned comparison catches both negative and too-large values. 3811 // Unsigned comparison catches both negative and too-large values.
3800 __ b(hs, &slow); 3812 __ b(hs, &miss);
3801 3813
3802 // Handle both smis and HeapNumbers in the fast path. Go to the 3814 // Handle both smis and HeapNumbers in the fast path. Go to the
3803 // runtime for all other kinds of values. 3815 // runtime for all other kinds of values.
3804 // r3: external array. 3816 // r3: external array.
3805 // r4: key (integer). 3817 // r4: key (integer).
3806 if (array_type == kExternalPixelArray) { 3818 if (array_type == kExternalPixelArray) {
3807 // Double to pixel conversion is only implemented in the runtime for now. 3819 // Double to pixel conversion is only implemented in the runtime for now.
3808 __ JumpIfNotSmi(value, &slow); 3820 __ JumpIfNotSmi(value, &slow);
3809 } else { 3821 } else {
3810 __ JumpIfNotSmi(value, &check_heap_number); 3822 __ JumpIfNotSmi(value, &check_heap_number);
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
4067 __ str(r5, MemOperand(r3, r4, LSL, 2)); 4079 __ str(r5, MemOperand(r3, r4, LSL, 2));
4068 break; 4080 break;
4069 default: 4081 default:
4070 UNREACHABLE(); 4082 UNREACHABLE();
4071 break; 4083 break;
4072 } 4084 }
4073 } 4085 }
4074 } 4086 }
4075 } 4087 }
4076 4088
4077 // Slow case: call runtime. 4089 // Slow case, key and receiver still in r0 and r1.
4078 __ bind(&slow); 4090 __ bind(&slow);
4091 __ IncrementCounter(
4092 masm()->isolate()->counters()->keyed_store_external_array_slow(),
4093 1, r3, r4);
4079 4094
4080 // Entry registers are intact. 4095 // Entry registers are intact.
4081 // ---------- S t a t e -------------- 4096 // ---------- S t a t e --------------
4082 // -- r0 : value 4097 // -- r0 : value
4083 // -- r1 : key 4098 // -- r1 : key
4084 // -- r2 : receiver 4099 // -- r2 : receiver
4085 // -- lr : return address 4100 // -- lr : return address
4086 // ----------------------------------- 4101 // -----------------------------------
4087 4102
4088 // Push receiver, key and value for runtime call. 4103 bool strict = (Code::ExtractExtraICStateFromFlags(flags) & kStrictMode) != 0;
4089 __ Push(r2, r1, r0); 4104 Handle<Code> ic = strict
4105 ? isolate()->builtins()->KeyedStoreIC_Slow_Strict()
4106 : isolate()->builtins()->KeyedStoreIC_Slow_NonStrict();
4107 __ Jump(ic, RelocInfo::CODE_TARGET);
4090 4108
4091 __ mov(r1, Operand(Smi::FromInt(NONE))); // PropertyAttributes 4109 // Miss case: call runtime.
4092 __ mov(r0, Operand(Smi::FromInt( 4110 __ bind(&miss);
4093 Code::ExtractExtraICStateFromFlags(flags) & kStrictMode))); 4111 // ----------- S t a t e -------------
4094 __ Push(r1, r0); 4112 // -- r0 : value
4113 // -- r1 : key
4114 // -- r2 : receiver
4115 // -- lr : return address
4116 // -----------------------------------
4095 4117
4096 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); 4118 Handle<Code> miss_ic = isolate()->builtins()->KeyedStoreIC_Miss();
4119 __ Jump(miss_ic, RelocInfo::CODE_TARGET);
4097 4120
4098 return GetCode(flags); 4121 return GetCode(flags);
4099 } 4122 }
4100 4123
4101 4124
4102 #undef __ 4125 #undef __
4103 4126
4104 } } // namespace v8::internal 4127 } } // namespace v8::internal
4105 4128
4106 #endif // V8_TARGET_ARCH_ARM 4129 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/builtins.h » ('j') | src/ia32/stub-cache-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698