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

Side by Side Diff: src/x64/code-stubs-x64.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/stub-cache.cc ('k') | src/x64/ic-x64.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 2424 matching lines...) Expand 10 before | Expand all | Expand 10 after
2435 receiver = rax; 2435 receiver = rax;
2436 } 2436 }
2437 2437
2438 StubCompiler::GenerateLoadStringLength(masm, receiver, r8, r9, &miss, 2438 StubCompiler::GenerateLoadStringLength(masm, receiver, r8, r9, &miss,
2439 support_wrapper_); 2439 support_wrapper_);
2440 __ bind(&miss); 2440 __ bind(&miss);
2441 StubCompiler::GenerateLoadMiss(masm, kind()); 2441 StubCompiler::GenerateLoadMiss(masm, kind());
2442 } 2442 }
2443 2443
2444 2444
2445 void StoreArrayLengthStub::Generate(MacroAssembler* masm) {
2446 // ----------- S t a t e -------------
2447 // -- rax : value
2448 // -- rcx : key
2449 // -- rdx : receiver
2450 // -- rsp[0] : return address
2451 // -----------------------------------
2452 //
2453 // This accepts as a receiver anything JSArray::SetElementsLength accepts
2454 // (currently anything except for external arrays which means anything with
2455 // elements of FixedArray type). Value must be a number, but only smis are
2456 // accepted as the most common case.
2457
2458 Label miss;
2459
2460 Register receiver = rdx;
2461 Register value = rax;
2462 Register scratch = rbx;
2463 if (kind() == Code::KEYED_STORE_IC) {
2464 __ Cmp(rcx, masm->isolate()->factory()->length_symbol());
2465 }
2466
2467 // Check that the receiver isn't a smi.
2468 __ JumpIfSmi(receiver, &miss);
2469
2470 // Check that the object is a JS array.
2471 __ CmpObjectType(receiver, JS_ARRAY_TYPE, scratch);
2472 __ j(not_equal, &miss);
2473
2474 // Check that elements are FixedArray.
2475 // We rely on StoreIC_ArrayLength below to deal with all types of
2476 // fast elements (including COW).
2477 __ movq(scratch, FieldOperand(receiver, JSArray::kElementsOffset));
2478 __ CmpObjectType(scratch, FIXED_ARRAY_TYPE, scratch);
2479 __ j(not_equal, &miss);
2480
2481 // Check that the array has fast properties, otherwise the length
2482 // property might have been redefined.
2483 __ movq(scratch, FieldOperand(receiver, JSArray::kPropertiesOffset));
2484 __ CompareRoot(FieldOperand(scratch, FixedArray::kMapOffset),
2485 Heap::kHashTableMapRootIndex);
2486 __ j(equal, &miss);
2487
2488 // Check that value is a smi.
2489 __ JumpIfNotSmi(value, &miss);
2490
2491 // Prepare tail call to StoreIC_ArrayLength.
2492 __ pop(scratch);
2493 __ push(receiver);
2494 __ push(value);
2495 __ push(scratch); // return address
2496
2497 ExternalReference ref =
2498 ExternalReference(IC_Utility(IC::kStoreIC_ArrayLength), masm->isolate());
2499 __ TailCallExternalReference(ref, 2, 1);
2500
2501 __ bind(&miss);
2502
2503 StubCompiler::GenerateStoreMiss(masm, kind());
2504 }
2505
2506
2445 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { 2507 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
2446 // The key is in rdx and the parameter count is in rax. 2508 // The key is in rdx and the parameter count is in rax.
2447 2509
2448 // The displacement is used for skipping the frame pointer on the 2510 // The displacement is used for skipping the frame pointer on the
2449 // stack. It is the offset of the last parameter (if any) relative 2511 // stack. It is the offset of the last parameter (if any) relative
2450 // to the frame pointer. 2512 // to the frame pointer.
2451 static const int kDisplacement = 1 * kPointerSize; 2513 static const int kDisplacement = 1 * kPointerSize;
2452 2514
2453 // Check that the key is a smi. 2515 // Check that the key is a smi.
2454 Label slow; 2516 Label slow;
(...skipping 4167 matching lines...) Expand 10 before | Expand all | Expand 10 after
6622 #endif 6684 #endif
6623 6685
6624 __ Ret(); 6686 __ Ret();
6625 } 6687 }
6626 6688
6627 #undef __ 6689 #undef __
6628 6690
6629 } } // namespace v8::internal 6691 } } // namespace v8::internal
6630 6692
6631 #endif // V8_TARGET_ARCH_X64 6693 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/stub-cache.cc ('k') | src/x64/ic-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698