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

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

Issue 12220074: Compile FastCloneShallowObjectStub using Crankshaft. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Implemented port to ARM. Created 7 years, 10 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
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 21 matching lines...) Expand all
32 #include "bootstrapper.h" 32 #include "bootstrapper.h"
33 #include "code-stubs.h" 33 #include "code-stubs.h"
34 #include "regexp-macro-assembler.h" 34 #include "regexp-macro-assembler.h"
35 #include "stub-cache.h" 35 #include "stub-cache.h"
36 #include "runtime.h" 36 #include "runtime.h"
37 37
38 namespace v8 { 38 namespace v8 {
39 namespace internal { 39 namespace internal {
40 40
41 41
42 void FastCloneShallowObjectStub::InitializeInterfaceDescriptor(
43 Isolate* isolate,
44 CodeStubInterfaceDescriptor* descriptor) {
45 static Register registers[] = { rax, rbx, rcx, rdx };
46 descriptor->register_param_count_ = 4;
47 descriptor->register_params_ = registers;
48 descriptor->stack_parameter_count_ = NULL;
49 descriptor->deoptimization_handler_ =
50 Runtime::FunctionForId(Runtime::kCreateObjectLiteralShallow)->entry;
51 }
52
53
42 void KeyedLoadFastElementStub::InitializeInterfaceDescriptor( 54 void KeyedLoadFastElementStub::InitializeInterfaceDescriptor(
43 Isolate* isolate, 55 Isolate* isolate,
44 CodeStubInterfaceDescriptor* descriptor) { 56 CodeStubInterfaceDescriptor* descriptor) {
45 static Register registers[] = { rdx, rax }; 57 static Register registers[] = { rdx, rax };
46 descriptor->register_param_count_ = 2; 58 descriptor->register_param_count_ = 2;
47 descriptor->register_params_ = registers; 59 descriptor->register_params_ = registers;
48 descriptor->stack_parameter_count_ = NULL; 60 descriptor->stack_parameter_count_ = NULL;
49 descriptor->deoptimization_handler_ = 61 descriptor->deoptimization_handler_ =
50 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); 62 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure);
51 } 63 }
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 GenerateFastCloneShallowArrayCommon(masm, length_, mode, 490 GenerateFastCloneShallowArrayCommon(masm, length_, mode,
479 allocation_site_mode_, 491 allocation_site_mode_,
480 &slow_case); 492 &slow_case);
481 __ ret(3 * kPointerSize); 493 __ ret(3 * kPointerSize);
482 494
483 __ bind(&slow_case); 495 __ bind(&slow_case);
484 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1); 496 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1);
485 } 497 }
486 498
487 499
488 void FastCloneShallowObjectStub::Generate(MacroAssembler* masm) {
489 // Stack layout on entry:
490 //
491 // [rsp + kPointerSize]: object literal flags.
492 // [rsp + (2 * kPointerSize)]: constant properties.
493 // [rsp + (3 * kPointerSize)]: literal index.
494 // [rsp + (4 * kPointerSize)]: literals array.
495
496 // Load boilerplate object into ecx and check if we need to create a
497 // boilerplate.
498 Label slow_case;
499 __ movq(rcx, Operand(rsp, 4 * kPointerSize));
500 __ movq(rax, Operand(rsp, 3 * kPointerSize));
501 SmiIndex index = masm->SmiToIndex(rax, rax, kPointerSizeLog2);
502 __ movq(rcx,
503 FieldOperand(rcx, index.reg, index.scale, FixedArray::kHeaderSize));
504 __ CompareRoot(rcx, Heap::kUndefinedValueRootIndex);
505 __ j(equal, &slow_case);
506
507 // Check that the boilerplate contains only fast properties and we can
508 // statically determine the instance size.
509 int size = JSObject::kHeaderSize + length_ * kPointerSize;
510 __ movq(rax, FieldOperand(rcx, HeapObject::kMapOffset));
511 __ movzxbq(rax, FieldOperand(rax, Map::kInstanceSizeOffset));
512 __ cmpq(rax, Immediate(size >> kPointerSizeLog2));
513 __ j(not_equal, &slow_case);
514
515 // Allocate the JS object and copy header together with all in-object
516 // properties from the boilerplate.
517 __ AllocateInNewSpace(size, rax, rbx, rdx, &slow_case, TAG_OBJECT);
518 for (int i = 0; i < size; i += kPointerSize) {
519 __ movq(rbx, FieldOperand(rcx, i));
520 __ movq(FieldOperand(rax, i), rbx);
521 }
522
523 // Return and remove the on-stack parameters.
524 __ ret(4 * kPointerSize);
525
526 __ bind(&slow_case);
527 __ TailCallRuntime(Runtime::kCreateObjectLiteralShallow, 4, 1);
528 }
529
530
531 // The stub expects its argument on the stack and returns its result in tos_: 500 // The stub expects its argument on the stack and returns its result in tos_:
532 // zero for false, and a non-zero value for true. 501 // zero for false, and a non-zero value for true.
533 void ToBooleanStub::Generate(MacroAssembler* masm) { 502 void ToBooleanStub::Generate(MacroAssembler* masm) {
534 // This stub overrides SometimesSetsUpAFrame() to return false. That means 503 // This stub overrides SometimesSetsUpAFrame() to return false. That means
535 // we cannot call anything that could cause a GC from this stub. 504 // we cannot call anything that could cause a GC from this stub.
536 Label patch; 505 Label patch;
537 const Register argument = rax; 506 const Register argument = rax;
538 const Register map = rdx; 507 const Register map = rdx;
539 508
540 if (!types_.IsEmpty()) { 509 if (!types_.IsEmpty()) {
(...skipping 6171 matching lines...) Expand 10 before | Expand all | Expand 10 after
6712 #endif 6681 #endif
6713 6682
6714 __ Ret(); 6683 __ Ret();
6715 } 6684 }
6716 6685
6717 #undef __ 6686 #undef __
6718 6687
6719 } } // namespace v8::internal 6688 } } // namespace v8::internal
6720 6689
6721 #endif // V8_TARGET_ARCH_X64 6690 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/hydrogen.h ('K') | « src/ia32/lithium-ia32.cc ('k') | src/x64/deoptimizer-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698