OLD | NEW |
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 Loading... |
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->stack_parameter_count_ = NULL; | 63 descriptor->stack_parameter_count_ = NULL; |
52 descriptor->deoptimization_handler_ = | 64 descriptor->deoptimization_handler_ = |
53 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); | 65 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); |
54 } | 66 } |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 &slow_case); | 499 &slow_case); |
488 | 500 |
489 // Return and remove the on-stack parameters. | 501 // Return and remove the on-stack parameters. |
490 __ ret(3 * kPointerSize); | 502 __ ret(3 * kPointerSize); |
491 | 503 |
492 __ bind(&slow_case); | 504 __ bind(&slow_case); |
493 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1); | 505 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1); |
494 } | 506 } |
495 | 507 |
496 | 508 |
497 void FastCloneShallowObjectStub::Generate(MacroAssembler* masm) { | |
498 // Stack layout on entry: | |
499 // | |
500 // [esp + kPointerSize]: object literal flags. | |
501 // [esp + (2 * kPointerSize)]: constant properties. | |
502 // [esp + (3 * kPointerSize)]: literal index. | |
503 // [esp + (4 * kPointerSize)]: literals array. | |
504 | |
505 // Load boilerplate object into ecx and check if we need to create a | |
506 // boilerplate. | |
507 Label slow_case; | |
508 __ mov(ecx, Operand(esp, 4 * kPointerSize)); | |
509 __ mov(eax, Operand(esp, 3 * kPointerSize)); | |
510 STATIC_ASSERT(kPointerSize == 4); | |
511 STATIC_ASSERT(kSmiTagSize == 1); | |
512 STATIC_ASSERT(kSmiTag == 0); | |
513 __ mov(ecx, FieldOperand(ecx, eax, times_half_pointer_size, | |
514 FixedArray::kHeaderSize)); | |
515 Factory* factory = masm->isolate()->factory(); | |
516 __ cmp(ecx, factory->undefined_value()); | |
517 __ j(equal, &slow_case); | |
518 | |
519 // Check that the boilerplate contains only fast properties and we can | |
520 // statically determine the instance size. | |
521 int size = JSObject::kHeaderSize + length_ * kPointerSize; | |
522 __ mov(eax, FieldOperand(ecx, HeapObject::kMapOffset)); | |
523 __ movzx_b(eax, FieldOperand(eax, Map::kInstanceSizeOffset)); | |
524 __ cmp(eax, Immediate(size >> kPointerSizeLog2)); | |
525 __ j(not_equal, &slow_case); | |
526 | |
527 // Allocate the JS object and copy header together with all in-object | |
528 // properties from the boilerplate. | |
529 __ AllocateInNewSpace(size, eax, ebx, edx, &slow_case, TAG_OBJECT); | |
530 for (int i = 0; i < size; i += kPointerSize) { | |
531 __ mov(ebx, FieldOperand(ecx, i)); | |
532 __ mov(FieldOperand(eax, i), ebx); | |
533 } | |
534 | |
535 // Return and remove the on-stack parameters. | |
536 __ ret(4 * kPointerSize); | |
537 | |
538 __ bind(&slow_case); | |
539 __ TailCallRuntime(Runtime::kCreateObjectLiteralShallow, 4, 1); | |
540 } | |
541 | |
542 | |
543 // The stub expects its argument on the stack and returns its result in tos_: | 509 // The stub expects its argument on the stack and returns its result in tos_: |
544 // zero for false, and a non-zero value for true. | 510 // zero for false, and a non-zero value for true. |
545 void ToBooleanStub::Generate(MacroAssembler* masm) { | 511 void ToBooleanStub::Generate(MacroAssembler* masm) { |
546 // This stub overrides SometimesSetsUpAFrame() to return false. That means | 512 // This stub overrides SometimesSetsUpAFrame() to return false. That means |
547 // we cannot call anything that could cause a GC from this stub. | 513 // we cannot call anything that could cause a GC from this stub. |
548 Label patch; | 514 Label patch; |
549 Factory* factory = masm->isolate()->factory(); | 515 Factory* factory = masm->isolate()->factory(); |
550 const Register argument = eax; | 516 const Register argument = eax; |
551 const Register map = edx; | 517 const Register map = edx; |
552 | 518 |
(...skipping 7134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7687 // Restore ecx. | 7653 // Restore ecx. |
7688 __ pop(ecx); | 7654 __ pop(ecx); |
7689 __ ret(0); | 7655 __ ret(0); |
7690 } | 7656 } |
7691 | 7657 |
7692 #undef __ | 7658 #undef __ |
7693 | 7659 |
7694 } } // namespace v8::internal | 7660 } } // namespace v8::internal |
7695 | 7661 |
7696 #endif // V8_TARGET_ARCH_IA32 | 7662 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |