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

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

Issue 2504153002: [TypeFeedbackVector] Root literal arrays in function literals slots (Closed)
Patch Set: REBASE. Created 4 years 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
OLDNEW
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 2431 matching lines...) Expand 10 before | Expand all | Expand 10 after
2442 assembler.Goto(&end); 2442 assembler.Goto(&end);
2443 } 2443 }
2444 2444
2445 assembler.Bind(&end); 2445 assembler.Bind(&end);
2446 assembler.Return(var_result.value()); 2446 assembler.Return(var_result.value());
2447 } 2447 }
2448 2448
2449 // static 2449 // static
2450 compiler::Node* FastNewClosureStub::Generate(CodeStubAssembler* assembler, 2450 compiler::Node* FastNewClosureStub::Generate(CodeStubAssembler* assembler,
2451 compiler::Node* shared_info, 2451 compiler::Node* shared_info,
2452 compiler::Node* feedback_vector,
2453 compiler::Node* slot,
2452 compiler::Node* context) { 2454 compiler::Node* context) {
2453 typedef compiler::Node Node; 2455 typedef compiler::Node Node;
2454 typedef compiler::CodeAssembler::Label Label; 2456 typedef compiler::CodeAssembler::Label Label;
2455 typedef compiler::CodeAssembler::Variable Variable; 2457 typedef compiler::CodeAssembler::Variable Variable;
2456 2458
2457 Isolate* isolate = assembler->isolate(); 2459 Isolate* isolate = assembler->isolate();
2458 Factory* factory = assembler->isolate()->factory(); 2460 Factory* factory = assembler->isolate()->factory();
2459 assembler->IncrementCounter(isolate->counters()->fast_new_closure_total(), 1); 2461 assembler->IncrementCounter(isolate->counters()->fast_new_closure_total(), 1);
2460 2462
2461 // Create a new closure from the given function info in new space 2463 // Create a new closure from the given function info in new space
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
2556 // as the map of the allocated object. 2558 // as the map of the allocated object.
2557 Node* native_context = assembler->LoadNativeContext(context); 2559 Node* native_context = assembler->LoadNativeContext(context);
2558 Node* map_slot_value = 2560 Node* map_slot_value =
2559 assembler->LoadFixedArrayElement(native_context, map_index.value(), 0, 2561 assembler->LoadFixedArrayElement(native_context, map_index.value(), 0,
2560 CodeStubAssembler::INTPTR_PARAMETERS); 2562 CodeStubAssembler::INTPTR_PARAMETERS);
2561 assembler->StoreMapNoWriteBarrier(result, map_slot_value); 2563 assembler->StoreMapNoWriteBarrier(result, map_slot_value);
2562 2564
2563 // Initialize the rest of the function. 2565 // Initialize the rest of the function.
2564 Node* empty_fixed_array = 2566 Node* empty_fixed_array =
2565 assembler->HeapConstant(factory->empty_fixed_array()); 2567 assembler->HeapConstant(factory->empty_fixed_array());
2566 Node* empty_literals_array =
2567 assembler->HeapConstant(factory->empty_literals_array());
2568 assembler->StoreObjectFieldNoWriteBarrier(result, JSObject::kPropertiesOffset, 2568 assembler->StoreObjectFieldNoWriteBarrier(result, JSObject::kPropertiesOffset,
2569 empty_fixed_array); 2569 empty_fixed_array);
2570 assembler->StoreObjectFieldNoWriteBarrier(result, JSObject::kElementsOffset, 2570 assembler->StoreObjectFieldNoWriteBarrier(result, JSObject::kElementsOffset,
2571 empty_fixed_array); 2571 empty_fixed_array);
2572 // TODO(mvstanton): Do I need a write barrier here?
Benedikt Meurer 2016/12/10 17:20:36 A write barrier for a load?
mvstanton 2016/12/21 13:09:13 Ach, sorry the todo is for the store of the litera
2573 Node* literals_array = assembler->LoadFixedArrayElement(
2574 feedback_vector, slot, 0, CodeStubAssembler::SMI_PARAMETERS);
2572 assembler->StoreObjectFieldNoWriteBarrier(result, JSFunction::kLiteralsOffset, 2575 assembler->StoreObjectFieldNoWriteBarrier(result, JSFunction::kLiteralsOffset,
2573 empty_literals_array); 2576 literals_array);
2574 assembler->StoreObjectFieldNoWriteBarrier( 2577 assembler->StoreObjectFieldNoWriteBarrier(
2575 result, JSFunction::kPrototypeOrInitialMapOffset, 2578 result, JSFunction::kPrototypeOrInitialMapOffset,
2576 assembler->TheHoleConstant()); 2579 assembler->TheHoleConstant());
2577 assembler->StoreObjectFieldNoWriteBarrier( 2580 assembler->StoreObjectFieldNoWriteBarrier(
2578 result, JSFunction::kSharedFunctionInfoOffset, shared_info); 2581 result, JSFunction::kSharedFunctionInfoOffset, shared_info);
2579 assembler->StoreObjectFieldNoWriteBarrier(result, JSFunction::kContextOffset, 2582 assembler->StoreObjectFieldNoWriteBarrier(result, JSFunction::kContextOffset,
2580 context); 2583 context);
2581 Handle<Code> lazy_builtin_handle( 2584 Handle<Code> lazy_builtin_handle(
2582 assembler->isolate()->builtins()->builtin(Builtins::kCompileLazy)); 2585 assembler->isolate()->builtins()->builtin(Builtins::kCompileLazy));
2583 Node* lazy_builtin = assembler->HeapConstant(lazy_builtin_handle); 2586 Node* lazy_builtin = assembler->HeapConstant(lazy_builtin_handle);
2584 Node* lazy_builtin_entry = assembler->IntPtrAdd( 2587 Node* lazy_builtin_entry = assembler->IntPtrAdd(
2585 lazy_builtin, 2588 lazy_builtin,
2586 assembler->IntPtrConstant(Code::kHeaderSize - kHeapObjectTag)); 2589 assembler->IntPtrConstant(Code::kHeaderSize - kHeapObjectTag));
2587 assembler->StoreObjectFieldNoWriteBarrier( 2590 assembler->StoreObjectFieldNoWriteBarrier(
2588 result, JSFunction::kCodeEntryOffset, lazy_builtin_entry); 2591 result, JSFunction::kCodeEntryOffset, lazy_builtin_entry);
2589 assembler->StoreObjectFieldNoWriteBarrier(result, 2592 assembler->StoreObjectFieldNoWriteBarrier(result,
2590 JSFunction::kNextFunctionLinkOffset, 2593 JSFunction::kNextFunctionLinkOffset,
2591 assembler->UndefinedConstant()); 2594 assembler->UndefinedConstant());
2592 2595
2593 return result; 2596 return result;
2594 } 2597 }
2595 2598
2596 void FastNewClosureStub::GenerateAssembly( 2599 void FastNewClosureStub::GenerateAssembly(
2597 compiler::CodeAssemblerState* state) const { 2600 compiler::CodeAssemblerState* state) const {
2598 CodeStubAssembler assembler(state); 2601 CodeStubAssembler assembler(state);
2599 assembler.Return( 2602 if (FLAG_strong_rooted_literals) {
2600 Generate(&assembler, assembler.Parameter(0), assembler.Parameter(1))); 2603 assembler.Return(Generate(&assembler, assembler.Parameter(0),
2604 assembler.Parameter(1), assembler.Parameter(2),
2605 assembler.Parameter(3)));
2606 } else {
2607 assembler.Return(Generate(&assembler, assembler.Parameter(0), NULL, NULL,
2608 assembler.Parameter(1)));
2609 }
2601 } 2610 }
2602 2611
2603 // static 2612 // static
2604 compiler::Node* FastNewFunctionContextStub::Generate( 2613 compiler::Node* FastNewFunctionContextStub::Generate(
2605 CodeStubAssembler* assembler, compiler::Node* function, 2614 CodeStubAssembler* assembler, compiler::Node* function,
2606 compiler::Node* slots, compiler::Node* context) { 2615 compiler::Node* slots, compiler::Node* context) {
2607 typedef compiler::Node Node; 2616 typedef compiler::Node Node;
2608 2617
2609 Node* min_context_slots = 2618 Node* min_context_slots =
2610 assembler->Int32Constant(Context::MIN_CONTEXT_SLOTS); 2619 assembler->Int32Constant(Context::MIN_CONTEXT_SLOTS);
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
3218 } 3227 }
3219 3228
3220 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) 3229 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate)
3221 : PlatformCodeStub(isolate) {} 3230 : PlatformCodeStub(isolate) {}
3222 3231
3223 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate) 3232 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate)
3224 : PlatformCodeStub(isolate) {} 3233 : PlatformCodeStub(isolate) {}
3225 3234
3226 } // namespace internal 3235 } // namespace internal
3227 } // namespace v8 3236 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/compiler.cc » ('j') | src/compiler/js-create-lowering.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698