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

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 11896091: Replace store array length builtin with codestub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Only inform of updating IC after actually updating it. Created 7 years, 11 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/code-stubs.cc ('k') | src/ia32/ic-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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 3299 matching lines...) Expand 10 before | Expand all | Expand 10 after
3310 __ j(not_equal, &miss); 3310 __ j(not_equal, &miss);
3311 } 3311 }
3312 3312
3313 StubCompiler::GenerateLoadStringLength(masm, edx, eax, ebx, &miss, 3313 StubCompiler::GenerateLoadStringLength(masm, edx, eax, ebx, &miss,
3314 support_wrapper_); 3314 support_wrapper_);
3315 __ bind(&miss); 3315 __ bind(&miss);
3316 StubCompiler::GenerateLoadMiss(masm, kind()); 3316 StubCompiler::GenerateLoadMiss(masm, kind());
3317 } 3317 }
3318 3318
3319 3319
3320 void StoreArrayLengthStub::Generate(MacroAssembler* masm) {
3321 // ----------- S t a t e -------------
3322 // -- eax : value
3323 // -- ecx : name
3324 // -- edx : receiver
3325 // -- esp[0] : return address
3326 // -----------------------------------
3327 //
3328 // This accepts as a receiver anything JSArray::SetElementsLength accepts
3329 // (currently anything except for external arrays which means anything with
3330 // elements of FixedArray type). Value must be a number, but only smis are
3331 // accepted as the most common case.
3332
3333 Label miss;
3334
3335 Register receiver = edx;
3336 Register value = eax;
3337 Register scratch = ebx;
3338
3339 if (kind() == Code::KEYED_LOAD_IC) {
3340 __ cmp(ecx, Immediate(masm->isolate()->factory()->length_symbol()));
3341 __ j(not_equal, &miss);
3342 }
3343
3344 // Check that the receiver isn't a smi.
3345 __ JumpIfSmi(receiver, &miss);
3346
3347 // Check that the object is a JS array.
3348 __ CmpObjectType(receiver, JS_ARRAY_TYPE, scratch);
3349 __ j(not_equal, &miss);
3350
3351 // Check that elements are FixedArray.
3352 // We rely on StoreIC_ArrayLength below to deal with all types of
3353 // fast elements (including COW).
3354 __ mov(scratch, FieldOperand(receiver, JSArray::kElementsOffset));
3355 __ CmpObjectType(scratch, FIXED_ARRAY_TYPE, scratch);
3356 __ j(not_equal, &miss);
3357
3358 // Check that the array has fast properties, otherwise the length
3359 // property might have been redefined.
3360 __ mov(scratch, FieldOperand(receiver, JSArray::kPropertiesOffset));
3361 __ CompareRoot(FieldOperand(scratch, FixedArray::kMapOffset),
3362 Heap::kHashTableMapRootIndex);
3363 __ j(equal, &miss);
3364
3365 // Check that value is a smi.
3366 __ JumpIfNotSmi(value, &miss);
3367
3368 // Prepare tail call to StoreIC_ArrayLength.
3369 __ pop(scratch);
3370 __ push(receiver);
3371 __ push(value);
3372 __ push(scratch); // return address
3373
3374 ExternalReference ref =
3375 ExternalReference(IC_Utility(IC::kStoreIC_ArrayLength), masm->isolate());
3376 __ TailCallExternalReference(ref, 2, 1);
3377
3378 __ bind(&miss);
3379
3380 StubCompiler::GenerateStoreMiss(masm, kind());
3381 }
3382
3383
3320 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { 3384 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
3321 // The key is in edx and the parameter count is in eax. 3385 // The key is in edx and the parameter count is in eax.
3322 3386
3323 // The displacement is used for skipping the frame pointer on the 3387 // The displacement is used for skipping the frame pointer on the
3324 // stack. It is the offset of the last parameter (if any) relative 3388 // stack. It is the offset of the last parameter (if any) relative
3325 // to the frame pointer. 3389 // to the frame pointer.
3326 static const int kDisplacement = 1 * kPointerSize; 3390 static const int kDisplacement = 1 * kPointerSize;
3327 3391
3328 // Check that the key is a smi. 3392 // Check that the key is a smi.
3329 Label slow; 3393 Label slow;
(...skipping 4264 matching lines...) Expand 10 before | Expand all | Expand 10 after
7594 // Restore ecx. 7658 // Restore ecx.
7595 __ pop(ecx); 7659 __ pop(ecx);
7596 __ ret(0); 7660 __ ret(0);
7597 } 7661 }
7598 7662
7599 #undef __ 7663 #undef __
7600 7664
7601 } } // namespace v8::internal 7665 } } // namespace v8::internal
7602 7666
7603 #endif // V8_TARGET_ARCH_IA32 7667 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/ia32/ic-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698