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

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

Issue 12220074: Compile FastCloneShallowObjectStub using Crankshaft. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased. Created 7 years, 9 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/hydrogen-instructions.h ('k') | src/ia32/deoptimizer-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 24 matching lines...) Expand all
35 #include "jsregexp.h" 35 #include "jsregexp.h"
36 #include "regexp-macro-assembler.h" 36 #include "regexp-macro-assembler.h"
37 #include "runtime.h" 37 #include "runtime.h"
38 #include "stub-cache.h" 38 #include "stub-cache.h"
39 #include "codegen.h" 39 #include "codegen.h"
40 40
41 namespace v8 { 41 namespace v8 {
42 namespace internal { 42 namespace internal {
43 43
44 44
45 void FastCloneShallowObjectStub::InitializeInterfaceDescriptor(
46 Isolate* isolate,
47 CodeStubInterfaceDescriptor* descriptor) {
48 static Register registers[] = { eax, ebx, ecx, edx };
49 descriptor->register_param_count_ = 4;
50 descriptor->register_params_ = registers;
51 descriptor->stack_parameter_count_ = NULL;
52 descriptor->deoptimization_handler_ =
53 Runtime::FunctionForId(Runtime::kCreateObjectLiteralShallow)->entry;
54 }
55
56
45 void KeyedLoadFastElementStub::InitializeInterfaceDescriptor( 57 void KeyedLoadFastElementStub::InitializeInterfaceDescriptor(
46 Isolate* isolate, 58 Isolate* isolate,
47 CodeStubInterfaceDescriptor* descriptor) { 59 CodeStubInterfaceDescriptor* descriptor) {
48 static Register registers[] = { edx, ecx }; 60 static Register registers[] = { edx, ecx };
49 descriptor->register_param_count_ = 2; 61 descriptor->register_param_count_ = 2;
50 descriptor->register_params_ = registers; 62 descriptor->register_params_ = registers;
51 descriptor->deoptimization_handler_ = 63 descriptor->deoptimization_handler_ =
52 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); 64 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure);
53 } 65 }
54 66
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 &slow_case); 498 &slow_case);
487 499
488 // Return and remove the on-stack parameters. 500 // Return and remove the on-stack parameters.
489 __ ret(3 * kPointerSize); 501 __ ret(3 * kPointerSize);
490 502
491 __ bind(&slow_case); 503 __ bind(&slow_case);
492 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1); 504 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1);
493 } 505 }
494 506
495 507
496 void FastCloneShallowObjectStub::Generate(MacroAssembler* masm) {
497 // Stack layout on entry:
498 //
499 // [esp + kPointerSize]: object literal flags.
500 // [esp + (2 * kPointerSize)]: constant properties.
501 // [esp + (3 * kPointerSize)]: literal index.
502 // [esp + (4 * kPointerSize)]: literals array.
503
504 // Load boilerplate object into ecx and check if we need to create a
505 // boilerplate.
506 Label slow_case;
507 __ mov(ecx, Operand(esp, 4 * kPointerSize));
508 __ mov(eax, Operand(esp, 3 * kPointerSize));
509 STATIC_ASSERT(kPointerSize == 4);
510 STATIC_ASSERT(kSmiTagSize == 1);
511 STATIC_ASSERT(kSmiTag == 0);
512 __ mov(ecx, FieldOperand(ecx, eax, times_half_pointer_size,
513 FixedArray::kHeaderSize));
514 Factory* factory = masm->isolate()->factory();
515 __ cmp(ecx, factory->undefined_value());
516 __ j(equal, &slow_case);
517
518 // Check that the boilerplate contains only fast properties and we can
519 // statically determine the instance size.
520 int size = JSObject::kHeaderSize + length_ * kPointerSize;
521 __ mov(eax, FieldOperand(ecx, HeapObject::kMapOffset));
522 __ movzx_b(eax, FieldOperand(eax, Map::kInstanceSizeOffset));
523 __ cmp(eax, Immediate(size >> kPointerSizeLog2));
524 __ j(not_equal, &slow_case);
525
526 // Allocate the JS object and copy header together with all in-object
527 // properties from the boilerplate.
528 __ AllocateInNewSpace(size, eax, ebx, edx, &slow_case, TAG_OBJECT);
529 for (int i = 0; i < size; i += kPointerSize) {
530 __ mov(ebx, FieldOperand(ecx, i));
531 __ mov(FieldOperand(eax, i), ebx);
532 }
533
534 // Return and remove the on-stack parameters.
535 __ ret(4 * kPointerSize);
536
537 __ bind(&slow_case);
538 __ TailCallRuntime(Runtime::kCreateObjectLiteralShallow, 4, 1);
539 }
540
541
542 // The stub expects its argument on the stack and returns its result in tos_: 508 // The stub expects its argument on the stack and returns its result in tos_:
543 // zero for false, and a non-zero value for true. 509 // zero for false, and a non-zero value for true.
544 void ToBooleanStub::Generate(MacroAssembler* masm) { 510 void ToBooleanStub::Generate(MacroAssembler* masm) {
545 // This stub overrides SometimesSetsUpAFrame() to return false. That means 511 // This stub overrides SometimesSetsUpAFrame() to return false. That means
546 // we cannot call anything that could cause a GC from this stub. 512 // we cannot call anything that could cause a GC from this stub.
547 Label patch; 513 Label patch;
548 Factory* factory = masm->isolate()->factory(); 514 Factory* factory = masm->isolate()->factory();
549 const Register argument = eax; 515 const Register argument = eax;
550 const Register map = edx; 516 const Register map = edx;
551 517
(...skipping 7162 matching lines...) Expand 10 before | Expand all | Expand 10 after
7714 // Restore ecx. 7680 // Restore ecx.
7715 __ pop(ecx); 7681 __ pop(ecx);
7716 __ ret(0); 7682 __ ret(0);
7717 } 7683 }
7718 7684
7719 #undef __ 7685 #undef __
7720 7686
7721 } } // namespace v8::internal 7687 } } // namespace v8::internal
7722 7688
7723 #endif // V8_TARGET_ARCH_IA32 7689 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/deoptimizer-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698