OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/code-stubs.h" | 5 #include "src/code-stubs.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 2420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2431 assembler.Goto(&end); | 2431 assembler.Goto(&end); |
2432 } | 2432 } |
2433 | 2433 |
2434 assembler.Bind(&end); | 2434 assembler.Bind(&end); |
2435 assembler.Return(var_result.value()); | 2435 assembler.Return(var_result.value()); |
2436 } | 2436 } |
2437 | 2437 |
2438 // static | 2438 // static |
2439 compiler::Node* FastNewClosureStub::Generate(CodeStubAssembler* assembler, | 2439 compiler::Node* FastNewClosureStub::Generate(CodeStubAssembler* assembler, |
2440 compiler::Node* shared_info, | 2440 compiler::Node* shared_info, |
2441 compiler::Node* feedback_vector, | |
2442 compiler::Node* slot, | |
2443 compiler::Node* context) { | 2441 compiler::Node* context) { |
2444 typedef compiler::Node Node; | 2442 typedef compiler::Node Node; |
2445 typedef compiler::CodeAssembler::Label Label; | 2443 typedef compiler::CodeAssembler::Label Label; |
2446 typedef compiler::CodeAssembler::Variable Variable; | 2444 typedef compiler::CodeAssembler::Variable Variable; |
2447 | 2445 |
2448 Isolate* isolate = assembler->isolate(); | 2446 Isolate* isolate = assembler->isolate(); |
2449 Factory* factory = assembler->isolate()->factory(); | 2447 Factory* factory = assembler->isolate()->factory(); |
2450 assembler->IncrementCounter(isolate->counters()->fast_new_closure_total(), 1); | 2448 assembler->IncrementCounter(isolate->counters()->fast_new_closure_total(), 1); |
2451 | 2449 |
2452 // Create a new closure from the given function info in new space | 2450 // Create a new closure from the given function info in new space |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2546 // Get the function map in the current native context and set that | 2544 // Get the function map in the current native context and set that |
2547 // as the map of the allocated object. | 2545 // as the map of the allocated object. |
2548 Node* native_context = assembler->LoadNativeContext(context); | 2546 Node* native_context = assembler->LoadNativeContext(context); |
2549 Node* map_slot_value = | 2547 Node* map_slot_value = |
2550 assembler->LoadFixedArrayElement(native_context, map_index.value()); | 2548 assembler->LoadFixedArrayElement(native_context, map_index.value()); |
2551 assembler->StoreMapNoWriteBarrier(result, map_slot_value); | 2549 assembler->StoreMapNoWriteBarrier(result, map_slot_value); |
2552 | 2550 |
2553 // Initialize the rest of the function. | 2551 // Initialize the rest of the function. |
2554 Node* empty_fixed_array = | 2552 Node* empty_fixed_array = |
2555 assembler->HeapConstant(factory->empty_fixed_array()); | 2553 assembler->HeapConstant(factory->empty_fixed_array()); |
| 2554 Node* empty_literals_array = |
| 2555 assembler->HeapConstant(factory->empty_literals_array()); |
2556 assembler->StoreObjectFieldNoWriteBarrier(result, JSObject::kPropertiesOffset, | 2556 assembler->StoreObjectFieldNoWriteBarrier(result, JSObject::kPropertiesOffset, |
2557 empty_fixed_array); | 2557 empty_fixed_array); |
2558 assembler->StoreObjectFieldNoWriteBarrier(result, JSObject::kElementsOffset, | 2558 assembler->StoreObjectFieldNoWriteBarrier(result, JSObject::kElementsOffset, |
2559 empty_fixed_array); | 2559 empty_fixed_array); |
2560 Node* literals_array = assembler->LoadFixedArrayElement( | |
2561 feedback_vector, slot, 0, CodeStubAssembler::SMI_PARAMETERS); | |
2562 assembler->StoreObjectFieldNoWriteBarrier(result, JSFunction::kLiteralsOffset, | 2560 assembler->StoreObjectFieldNoWriteBarrier(result, JSFunction::kLiteralsOffset, |
2563 literals_array); | 2561 empty_literals_array); |
2564 assembler->StoreObjectFieldNoWriteBarrier( | 2562 assembler->StoreObjectFieldNoWriteBarrier( |
2565 result, JSFunction::kPrototypeOrInitialMapOffset, | 2563 result, JSFunction::kPrototypeOrInitialMapOffset, |
2566 assembler->TheHoleConstant()); | 2564 assembler->TheHoleConstant()); |
2567 assembler->StoreObjectFieldNoWriteBarrier( | 2565 assembler->StoreObjectFieldNoWriteBarrier( |
2568 result, JSFunction::kSharedFunctionInfoOffset, shared_info); | 2566 result, JSFunction::kSharedFunctionInfoOffset, shared_info); |
2569 assembler->StoreObjectFieldNoWriteBarrier(result, JSFunction::kContextOffset, | 2567 assembler->StoreObjectFieldNoWriteBarrier(result, JSFunction::kContextOffset, |
2570 context); | 2568 context); |
2571 Handle<Code> lazy_builtin_handle( | 2569 Handle<Code> lazy_builtin_handle( |
2572 assembler->isolate()->builtins()->builtin(Builtins::kCompileLazy)); | 2570 assembler->isolate()->builtins()->builtin(Builtins::kCompileLazy)); |
2573 Node* lazy_builtin = assembler->HeapConstant(lazy_builtin_handle); | 2571 Node* lazy_builtin = assembler->HeapConstant(lazy_builtin_handle); |
2574 Node* lazy_builtin_entry = assembler->IntPtrAdd( | 2572 Node* lazy_builtin_entry = assembler->IntPtrAdd( |
2575 assembler->BitcastTaggedToWord(lazy_builtin), | 2573 assembler->BitcastTaggedToWord(lazy_builtin), |
2576 assembler->IntPtrConstant(Code::kHeaderSize - kHeapObjectTag)); | 2574 assembler->IntPtrConstant(Code::kHeaderSize - kHeapObjectTag)); |
2577 assembler->StoreObjectFieldNoWriteBarrier( | 2575 assembler->StoreObjectFieldNoWriteBarrier( |
2578 result, JSFunction::kCodeEntryOffset, lazy_builtin_entry, | 2576 result, JSFunction::kCodeEntryOffset, lazy_builtin_entry, |
2579 MachineType::PointerRepresentation()); | 2577 MachineType::PointerRepresentation()); |
2580 assembler->StoreObjectFieldNoWriteBarrier(result, | 2578 assembler->StoreObjectFieldNoWriteBarrier(result, |
2581 JSFunction::kNextFunctionLinkOffset, | 2579 JSFunction::kNextFunctionLinkOffset, |
2582 assembler->UndefinedConstant()); | 2580 assembler->UndefinedConstant()); |
2583 | 2581 |
2584 return result; | 2582 return result; |
2585 } | 2583 } |
2586 | 2584 |
2587 void FastNewClosureStub::GenerateAssembly( | 2585 void FastNewClosureStub::GenerateAssembly( |
2588 compiler::CodeAssemblerState* state) const { | 2586 compiler::CodeAssemblerState* state) const { |
| 2587 typedef compiler::Node Node; |
2589 CodeStubAssembler assembler(state); | 2588 CodeStubAssembler assembler(state); |
2590 typedef compiler::Node Node; | |
2591 Node* shared = assembler.Parameter(Descriptor::kSharedFunctionInfo); | 2589 Node* shared = assembler.Parameter(Descriptor::kSharedFunctionInfo); |
2592 Node* context = assembler.Parameter(Descriptor::kContext); | 2590 Node* context = assembler.Parameter(Descriptor::kContext); |
2593 Node* vector = assembler.Parameter(Descriptor::kVector); | 2591 assembler.Return(Generate(&assembler, shared, context)); |
2594 Node* slot = assembler.Parameter(Descriptor::kSlot); | |
2595 assembler.Return(Generate(&assembler, shared, vector, slot, context)); | |
2596 } | 2592 } |
2597 | 2593 |
2598 // static | 2594 // static |
2599 int FastNewFunctionContextStub::MaximumSlots() { | 2595 int FastNewFunctionContextStub::MaximumSlots() { |
2600 return FLAG_test_small_max_function_context_stub_size ? kSmallMaximumSlots | 2596 return FLAG_test_small_max_function_context_stub_size ? kSmallMaximumSlots |
2601 : kMaximumSlots; | 2597 : kMaximumSlots; |
2602 } | 2598 } |
2603 | 2599 |
2604 // static | 2600 // static |
2605 compiler::Node* FastNewFunctionContextStub::Generate( | 2601 compiler::Node* FastNewFunctionContextStub::Generate( |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3227 } | 3223 } |
3228 | 3224 |
3229 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) | 3225 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) |
3230 : PlatformCodeStub(isolate) {} | 3226 : PlatformCodeStub(isolate) {} |
3231 | 3227 |
3232 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate) | 3228 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate) |
3233 : PlatformCodeStub(isolate) {} | 3229 : PlatformCodeStub(isolate) {} |
3234 | 3230 |
3235 } // namespace internal | 3231 } // namespace internal |
3236 } // namespace v8 | 3232 } // namespace v8 |
OLD | NEW |