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

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 1407913003: [turbofan] Remove obsolete JSTypeFeedbackSpecializer and JSTypeFeedbackLowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@NamedAccess
Patch Set: REBASE Created 5 years, 2 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
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/compiler/js-type-feedback.h » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/compiler/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/ast-loop-assignment-analyzer.h" 8 #include "src/compiler/ast-loop-assignment-analyzer.h"
9 #include "src/compiler/control-builders.h" 9 #include "src/compiler/control-builders.h"
10 #include "src/compiler/js-type-feedback.h"
11 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
12 #include "src/compiler/liveness-analyzer.h" 11 #include "src/compiler/liveness-analyzer.h"
13 #include "src/compiler/machine-operator.h" 12 #include "src/compiler/machine-operator.h"
14 #include "src/compiler/node-matchers.h" 13 #include "src/compiler/node-matchers.h"
15 #include "src/compiler/node-properties.h" 14 #include "src/compiler/node-properties.h"
16 #include "src/compiler/operator-properties.h" 15 #include "src/compiler/operator-properties.h"
17 #include "src/compiler/state-values-utils.h" 16 #include "src/compiler/state-values-utils.h"
18 #include "src/parser.h" 17 #include "src/parser.h"
19 #include "src/scopes.h" 18 #include "src/scopes.h"
20 19
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 } 420 }
422 } 421 }
423 422
424 private: 423 private:
425 AstGraphBuilder* builder_; 424 AstGraphBuilder* builder_;
426 Node* frame_state_before_; 425 Node* frame_state_before_;
427 }; 426 };
428 427
429 428
430 AstGraphBuilder::AstGraphBuilder(Zone* local_zone, CompilationInfo* info, 429 AstGraphBuilder::AstGraphBuilder(Zone* local_zone, CompilationInfo* info,
431 JSGraph* jsgraph, LoopAssignmentAnalysis* loop, 430 JSGraph* jsgraph, LoopAssignmentAnalysis* loop)
432 JSTypeFeedbackTable* js_type_feedback)
433 : isolate_(info->isolate()), 431 : isolate_(info->isolate()),
434 local_zone_(local_zone), 432 local_zone_(local_zone),
435 info_(info), 433 info_(info),
436 jsgraph_(jsgraph), 434 jsgraph_(jsgraph),
437 environment_(nullptr), 435 environment_(nullptr),
438 ast_context_(nullptr), 436 ast_context_(nullptr),
439 globals_(0, local_zone), 437 globals_(0, local_zone),
440 execution_control_(nullptr), 438 execution_control_(nullptr),
441 execution_context_(nullptr), 439 execution_context_(nullptr),
442 try_catch_nesting_level_(0), 440 try_catch_nesting_level_(0),
443 try_nesting_level_(0), 441 try_nesting_level_(0),
444 input_buffer_size_(0), 442 input_buffer_size_(0),
445 input_buffer_(nullptr), 443 input_buffer_(nullptr),
446 exit_controls_(local_zone), 444 exit_controls_(local_zone),
447 loop_assignment_analysis_(loop), 445 loop_assignment_analysis_(loop),
448 state_values_cache_(jsgraph), 446 state_values_cache_(jsgraph),
449 liveness_analyzer_(static_cast<size_t>(info->scope()->num_stack_slots()), 447 liveness_analyzer_(static_cast<size_t>(info->scope()->num_stack_slots()),
450 local_zone), 448 local_zone),
451 frame_state_function_info_(common()->CreateFrameStateFunctionInfo( 449 frame_state_function_info_(common()->CreateFrameStateFunctionInfo(
452 FrameStateType::kJavaScriptFunction, info->num_parameters() + 1, 450 FrameStateType::kJavaScriptFunction, info->num_parameters() + 1,
453 info->scope()->num_stack_slots(), info->shared_info(), 451 info->scope()->num_stack_slots(), info->shared_info(),
454 CALL_MAINTAINS_NATIVE_CONTEXT)), 452 CALL_MAINTAINS_NATIVE_CONTEXT)) {
455 js_type_feedback_(js_type_feedback) {
456 InitializeAstVisitor(info->isolate()); 453 InitializeAstVisitor(info->isolate());
457 } 454 }
458 455
459 456
460 Node* AstGraphBuilder::GetFunctionClosureForContext() { 457 Node* AstGraphBuilder::GetFunctionClosureForContext() {
461 Scope* closure_scope = current_scope()->ClosureScope(); 458 Scope* closure_scope = current_scope()->ClosureScope();
462 if (closure_scope->is_script_scope() || 459 if (closure_scope->is_script_scope() ||
463 closure_scope->is_module_scope()) { 460 closure_scope->is_module_scope()) {
464 // Contexts nested in the native context have a canonical empty function as 461 // Contexts nested in the native context have a canonical empty function as
465 // their closure, not the anonymous closure containing the global code. 462 // their closure, not the anonymous closure containing the global code.
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1746 // It is safe to use [[Put]] here because the boilerplate already 1743 // It is safe to use [[Put]] here because the boilerplate already
1747 // contains computed properties with an uninitialized value. 1744 // contains computed properties with an uninitialized value.
1748 if (key->value()->IsInternalizedString()) { 1745 if (key->value()->IsInternalizedString()) {
1749 if (property->emit_store()) { 1746 if (property->emit_store()) {
1750 VisitForValue(property->value()); 1747 VisitForValue(property->value());
1751 FrameStateBeforeAndAfter states(this, property->value()->id()); 1748 FrameStateBeforeAndAfter states(this, property->value()->id());
1752 Node* value = environment()->Pop(); 1749 Node* value = environment()->Pop();
1753 Handle<Name> name = key->AsPropertyName(); 1750 Handle<Name> name = key->AsPropertyName();
1754 VectorSlotPair feedback = 1751 VectorSlotPair feedback =
1755 CreateVectorSlotPair(property->GetSlot(0)); 1752 CreateVectorSlotPair(property->GetSlot(0));
1756 Node* store = BuildNamedStore(literal, name, value, feedback, 1753 Node* store = BuildNamedStore(literal, name, value, feedback);
1757 TypeFeedbackId::None());
1758 states.AddToNode(store, key->id(), 1754 states.AddToNode(store, key->id(),
1759 OutputFrameStateCombine::Ignore()); 1755 OutputFrameStateCombine::Ignore());
1760 BuildSetHomeObject(value, literal, property, 1); 1756 BuildSetHomeObject(value, literal, property, 1);
1761 } else { 1757 } else {
1762 VisitForEffect(property->value()); 1758 VisitForEffect(property->value());
1763 } 1759 }
1764 break; 1760 break;
1765 } 1761 }
1766 environment()->Push(literal); // Duplicate receiver. 1762 environment()->Push(literal); // Duplicate receiver.
1767 VisitForValue(property->key()); 1763 VisitForValue(property->key());
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1939 Expression* subexpr = expr->values()->at(array_index); 1935 Expression* subexpr = expr->values()->at(array_index);
1940 if (subexpr->IsSpread()) break; 1936 if (subexpr->IsSpread()) break;
1941 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; 1937 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue;
1942 1938
1943 VisitForValue(subexpr); 1939 VisitForValue(subexpr);
1944 { 1940 {
1945 FrameStateBeforeAndAfter states(this, subexpr->id()); 1941 FrameStateBeforeAndAfter states(this, subexpr->id());
1946 VectorSlotPair pair = CreateVectorSlotPair(expr->LiteralFeedbackSlot()); 1942 VectorSlotPair pair = CreateVectorSlotPair(expr->LiteralFeedbackSlot());
1947 Node* value = environment()->Pop(); 1943 Node* value = environment()->Pop();
1948 Node* index = jsgraph()->Constant(array_index); 1944 Node* index = jsgraph()->Constant(array_index);
1949 Node* store = 1945 Node* store = BuildKeyedStore(literal, index, value, pair);
1950 BuildKeyedStore(literal, index, value, pair, TypeFeedbackId::None());
1951 states.AddToNode(store, expr->GetIdForElement(array_index), 1946 states.AddToNode(store, expr->GetIdForElement(array_index),
1952 OutputFrameStateCombine::Ignore()); 1947 OutputFrameStateCombine::Ignore());
1953 } 1948 }
1954 } 1949 }
1955 1950
1956 // In case the array literal contains spread expressions it has two parts. The 1951 // In case the array literal contains spread expressions it has two parts. The
1957 // first part is the "static" array which has a literal index is handled 1952 // first part is the "static" array which has a literal index is handled
1958 // above. The second part is the part after the first spread expression 1953 // above. The second part is the part after the first spread expression
1959 // (inclusive) and these elements gets appended to the array. Note that the 1954 // (inclusive) and these elements gets appended to the array. Note that the
1960 // number elements an iterable produces is unknown ahead of time. 1955 // number elements an iterable produces is unknown ahead of time.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 bailout_id_after, states); 2004 bailout_id_after, states);
2010 break; 2005 break;
2011 } 2006 }
2012 case NAMED_PROPERTY: { 2007 case NAMED_PROPERTY: {
2013 environment()->Push(value); 2008 environment()->Push(value);
2014 VisitForValue(property->obj()); 2009 VisitForValue(property->obj());
2015 FrameStateBeforeAndAfter states(this, property->obj()->id()); 2010 FrameStateBeforeAndAfter states(this, property->obj()->id());
2016 Node* object = environment()->Pop(); 2011 Node* object = environment()->Pop();
2017 value = environment()->Pop(); 2012 value = environment()->Pop();
2018 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); 2013 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName();
2019 Node* store = BuildNamedStore(object, name, value, feedback, 2014 Node* store = BuildNamedStore(object, name, value, feedback);
2020 TypeFeedbackId::None());
2021 states.AddToNode(store, bailout_id_after, 2015 states.AddToNode(store, bailout_id_after,
2022 OutputFrameStateCombine::Ignore()); 2016 OutputFrameStateCombine::Ignore());
2023 break; 2017 break;
2024 } 2018 }
2025 case KEYED_PROPERTY: { 2019 case KEYED_PROPERTY: {
2026 environment()->Push(value); 2020 environment()->Push(value);
2027 VisitForValue(property->obj()); 2021 VisitForValue(property->obj());
2028 VisitForValue(property->key()); 2022 VisitForValue(property->key());
2029 FrameStateBeforeAndAfter states(this, property->key()->id()); 2023 FrameStateBeforeAndAfter states(this, property->key()->id());
2030 Node* key = environment()->Pop(); 2024 Node* key = environment()->Pop();
2031 Node* object = environment()->Pop(); 2025 Node* object = environment()->Pop();
2032 value = environment()->Pop(); 2026 value = environment()->Pop();
2033 Node* store = 2027 Node* store = BuildKeyedStore(object, key, value, feedback);
2034 BuildKeyedStore(object, key, value, feedback, TypeFeedbackId::None());
2035 states.AddToNode(store, bailout_id_after, 2028 states.AddToNode(store, bailout_id_after,
2036 OutputFrameStateCombine::Ignore()); 2029 OutputFrameStateCombine::Ignore());
2037 break; 2030 break;
2038 } 2031 }
2039 case NAMED_SUPER_PROPERTY: { 2032 case NAMED_SUPER_PROPERTY: {
2040 environment()->Push(value); 2033 environment()->Push(value);
2041 VisitForValue(property->obj()->AsSuperPropertyReference()->this_var()); 2034 VisitForValue(property->obj()->AsSuperPropertyReference()->this_var());
2042 VisitForValue(property->obj()->AsSuperPropertyReference()->home_object()); 2035 VisitForValue(property->obj()->AsSuperPropertyReference()->home_object());
2043 FrameStateBeforeAndAfter states(this, property->obj()->id()); 2036 FrameStateBeforeAndAfter states(this, property->obj()->id());
2044 Node* home_object = environment()->Pop(); 2037 Node* home_object = environment()->Pop();
2045 Node* receiver = environment()->Pop(); 2038 Node* receiver = environment()->Pop();
2046 value = environment()->Pop(); 2039 value = environment()->Pop();
2047 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); 2040 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName();
2048 Node* store = BuildNamedSuperStore(receiver, home_object, name, value, 2041 Node* store = BuildNamedSuperStore(receiver, home_object, name, value);
2049 TypeFeedbackId::None());
2050 states.AddToNode(store, bailout_id_after, 2042 states.AddToNode(store, bailout_id_after,
2051 OutputFrameStateCombine::Ignore()); 2043 OutputFrameStateCombine::Ignore());
2052 break; 2044 break;
2053 } 2045 }
2054 case KEYED_SUPER_PROPERTY: { 2046 case KEYED_SUPER_PROPERTY: {
2055 environment()->Push(value); 2047 environment()->Push(value);
2056 VisitForValue(property->obj()->AsSuperPropertyReference()->this_var()); 2048 VisitForValue(property->obj()->AsSuperPropertyReference()->this_var());
2057 VisitForValue(property->obj()->AsSuperPropertyReference()->home_object()); 2049 VisitForValue(property->obj()->AsSuperPropertyReference()->home_object());
2058 VisitForValue(property->key()); 2050 VisitForValue(property->key());
2059 FrameStateBeforeAndAfter states(this, property->key()->id()); 2051 FrameStateBeforeAndAfter states(this, property->key()->id());
2060 Node* key = environment()->Pop(); 2052 Node* key = environment()->Pop();
2061 Node* home_object = environment()->Pop(); 2053 Node* home_object = environment()->Pop();
2062 Node* receiver = environment()->Pop(); 2054 Node* receiver = environment()->Pop();
2063 value = environment()->Pop(); 2055 value = environment()->Pop();
2064 Node* store = BuildKeyedSuperStore(receiver, home_object, key, value, 2056 Node* store = BuildKeyedSuperStore(receiver, home_object, key, value);
2065 TypeFeedbackId::None());
2066 states.AddToNode(store, bailout_id_after, 2057 states.AddToNode(store, bailout_id_after,
2067 OutputFrameStateCombine::Ignore()); 2058 OutputFrameStateCombine::Ignore());
2068 break; 2059 break;
2069 } 2060 }
2070 } 2061 }
2071 } 2062 }
2072 2063
2073 2064
2074 void AstGraphBuilder::VisitAssignment(Assignment* expr) { 2065 void AstGraphBuilder::VisitAssignment(Assignment* expr) {
2075 DCHECK(expr->target()->IsValidReferenceExpressionOrThis()); 2066 DCHECK(expr->target()->IsValidReferenceExpressionOrThis());
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2200 switch (assign_type) { 2191 switch (assign_type) {
2201 case VARIABLE: { 2192 case VARIABLE: {
2202 Variable* variable = expr->target()->AsVariableProxy()->var(); 2193 Variable* variable = expr->target()->AsVariableProxy()->var();
2203 BuildVariableAssignment(variable, value, expr->op(), feedback, expr->id(), 2194 BuildVariableAssignment(variable, value, expr->op(), feedback, expr->id(),
2204 store_states, ast_context()->GetStateCombine()); 2195 store_states, ast_context()->GetStateCombine());
2205 break; 2196 break;
2206 } 2197 }
2207 case NAMED_PROPERTY: { 2198 case NAMED_PROPERTY: {
2208 Node* object = environment()->Pop(); 2199 Node* object = environment()->Pop();
2209 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); 2200 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName();
2210 Node* store = BuildNamedStore(object, name, value, feedback, 2201 Node* store = BuildNamedStore(object, name, value, feedback);
2211 expr->AssignmentFeedbackId());
2212 store_states.AddToNode(store, expr->id(), 2202 store_states.AddToNode(store, expr->id(),
2213 ast_context()->GetStateCombine()); 2203 ast_context()->GetStateCombine());
2214 break; 2204 break;
2215 } 2205 }
2216 case KEYED_PROPERTY: { 2206 case KEYED_PROPERTY: {
2217 Node* key = environment()->Pop(); 2207 Node* key = environment()->Pop();
2218 Node* object = environment()->Pop(); 2208 Node* object = environment()->Pop();
2219 Node* store = BuildKeyedStore(object, key, value, feedback, 2209 Node* store = BuildKeyedStore(object, key, value, feedback);
2220 expr->AssignmentFeedbackId());
2221 store_states.AddToNode(store, expr->id(), 2210 store_states.AddToNode(store, expr->id(),
2222 ast_context()->GetStateCombine()); 2211 ast_context()->GetStateCombine());
2223 break; 2212 break;
2224 } 2213 }
2225 case NAMED_SUPER_PROPERTY: { 2214 case NAMED_SUPER_PROPERTY: {
2226 Node* home_object = environment()->Pop(); 2215 Node* home_object = environment()->Pop();
2227 Node* receiver = environment()->Pop(); 2216 Node* receiver = environment()->Pop();
2228 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); 2217 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName();
2229 Node* store = BuildNamedSuperStore(receiver, home_object, name, value, 2218 Node* store = BuildNamedSuperStore(receiver, home_object, name, value);
2230 expr->AssignmentFeedbackId());
2231 store_states.AddToNode(store, expr->id(), 2219 store_states.AddToNode(store, expr->id(),
2232 ast_context()->GetStateCombine()); 2220 ast_context()->GetStateCombine());
2233 break; 2221 break;
2234 } 2222 }
2235 case KEYED_SUPER_PROPERTY: { 2223 case KEYED_SUPER_PROPERTY: {
2236 Node* key = environment()->Pop(); 2224 Node* key = environment()->Pop();
2237 Node* home_object = environment()->Pop(); 2225 Node* home_object = environment()->Pop();
2238 Node* receiver = environment()->Pop(); 2226 Node* receiver = environment()->Pop();
2239 Node* store = BuildKeyedSuperStore(receiver, home_object, key, value, 2227 Node* store = BuildKeyedSuperStore(receiver, home_object, key, value);
2240 expr->AssignmentFeedbackId());
2241 store_states.AddToNode(store, expr->id(), 2228 store_states.AddToNode(store, expr->id(),
2242 ast_context()->GetStateCombine()); 2229 ast_context()->GetStateCombine());
2243 break; 2230 break;
2244 } 2231 }
2245 } 2232 }
2246 2233
2247 ast_context()->ProduceValue(value); 2234 ast_context()->ProduceValue(value);
2248 } 2235 }
2249 2236
2250 2237
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
2718 Variable* variable = expr->expression()->AsVariableProxy()->var(); 2705 Variable* variable = expr->expression()->AsVariableProxy()->var();
2719 environment()->Push(value); 2706 environment()->Push(value);
2720 BuildVariableAssignment(variable, value, expr->op(), feedback, 2707 BuildVariableAssignment(variable, value, expr->op(), feedback,
2721 expr->AssignmentId(), store_states); 2708 expr->AssignmentId(), store_states);
2722 environment()->Pop(); 2709 environment()->Pop();
2723 break; 2710 break;
2724 } 2711 }
2725 case NAMED_PROPERTY: { 2712 case NAMED_PROPERTY: {
2726 Node* object = environment()->Pop(); 2713 Node* object = environment()->Pop();
2727 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); 2714 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName();
2728 Node* store = BuildNamedStore(object, name, value, feedback, 2715 Node* store = BuildNamedStore(object, name, value, feedback);
2729 expr->CountStoreFeedbackId());
2730 environment()->Push(value); 2716 environment()->Push(value);
2731 store_states.AddToNode(store, expr->AssignmentId(), 2717 store_states.AddToNode(store, expr->AssignmentId(),
2732 OutputFrameStateCombine::Ignore()); 2718 OutputFrameStateCombine::Ignore());
2733 environment()->Pop(); 2719 environment()->Pop();
2734 break; 2720 break;
2735 } 2721 }
2736 case KEYED_PROPERTY: { 2722 case KEYED_PROPERTY: {
2737 Node* key = environment()->Pop(); 2723 Node* key = environment()->Pop();
2738 Node* object = environment()->Pop(); 2724 Node* object = environment()->Pop();
2739 Node* store = BuildKeyedStore(object, key, value, feedback, 2725 Node* store = BuildKeyedStore(object, key, value, feedback);
2740 expr->CountStoreFeedbackId());
2741 environment()->Push(value); 2726 environment()->Push(value);
2742 store_states.AddToNode(store, expr->AssignmentId(), 2727 store_states.AddToNode(store, expr->AssignmentId(),
2743 OutputFrameStateCombine::Ignore()); 2728 OutputFrameStateCombine::Ignore());
2744 environment()->Pop(); 2729 environment()->Pop();
2745 break; 2730 break;
2746 } 2731 }
2747 case NAMED_SUPER_PROPERTY: { 2732 case NAMED_SUPER_PROPERTY: {
2748 Node* home_object = environment()->Pop(); 2733 Node* home_object = environment()->Pop();
2749 Node* receiver = environment()->Pop(); 2734 Node* receiver = environment()->Pop();
2750 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); 2735 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName();
2751 Node* store = BuildNamedSuperStore(receiver, home_object, name, value, 2736 Node* store = BuildNamedSuperStore(receiver, home_object, name, value);
2752 expr->CountStoreFeedbackId());
2753 environment()->Push(value); 2737 environment()->Push(value);
2754 store_states.AddToNode(store, expr->AssignmentId(), 2738 store_states.AddToNode(store, expr->AssignmentId(),
2755 OutputFrameStateCombine::Ignore()); 2739 OutputFrameStateCombine::Ignore());
2756 environment()->Pop(); 2740 environment()->Pop();
2757 break; 2741 break;
2758 } 2742 }
2759 case KEYED_SUPER_PROPERTY: { 2743 case KEYED_SUPER_PROPERTY: {
2760 Node* key = environment()->Pop(); 2744 Node* key = environment()->Pop();
2761 Node* home_object = environment()->Pop(); 2745 Node* home_object = environment()->Pop();
2762 Node* receiver = environment()->Pop(); 2746 Node* receiver = environment()->Pop();
2763 Node* store = BuildKeyedSuperStore(receiver, home_object, key, value, 2747 Node* store = BuildKeyedSuperStore(receiver, home_object, key, value);
2764 expr->CountStoreFeedbackId());
2765 environment()->Push(value); 2748 environment()->Push(value);
2766 store_states.AddToNode(store, expr->AssignmentId(), 2749 store_states.AddToNode(store, expr->AssignmentId(),
2767 OutputFrameStateCombine::Ignore()); 2750 OutputFrameStateCombine::Ignore());
2768 environment()->Pop(); 2751 environment()->Pop();
2769 break; 2752 break;
2770 } 2753 }
2771 } 2754 }
2772 2755
2773 // Restore old value for postfix expressions. 2756 // Restore old value for postfix expressions.
2774 if (is_postfix) value = environment()->Pop(); 2757 if (is_postfix) value = environment()->Pop();
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
3441 Variable* variable, Node* value, Token::Value op, 3424 Variable* variable, Node* value, Token::Value op,
3442 const VectorSlotPair& feedback, BailoutId bailout_id, 3425 const VectorSlotPair& feedback, BailoutId bailout_id,
3443 FrameStateBeforeAndAfter& states, OutputFrameStateCombine combine) { 3426 FrameStateBeforeAndAfter& states, OutputFrameStateCombine combine) {
3444 Node* the_hole = jsgraph()->TheHoleConstant(); 3427 Node* the_hole = jsgraph()->TheHoleConstant();
3445 VariableMode mode = variable->mode(); 3428 VariableMode mode = variable->mode();
3446 switch (variable->location()) { 3429 switch (variable->location()) {
3447 case VariableLocation::GLOBAL: 3430 case VariableLocation::GLOBAL:
3448 case VariableLocation::UNALLOCATED: { 3431 case VariableLocation::UNALLOCATED: {
3449 // Global var, const, or let variable. 3432 // Global var, const, or let variable.
3450 Handle<Name> name = variable->name(); 3433 Handle<Name> name = variable->name();
3451 Node* store = 3434 Node* store = BuildGlobalStore(name, value, feedback);
3452 BuildGlobalStore(name, value, feedback, TypeFeedbackId::None());
3453 states.AddToNode(store, bailout_id, combine); 3435 states.AddToNode(store, bailout_id, combine);
3454 return store; 3436 return store;
3455 } 3437 }
3456 case VariableLocation::PARAMETER: 3438 case VariableLocation::PARAMETER:
3457 case VariableLocation::LOCAL: 3439 case VariableLocation::LOCAL:
3458 // Local var, const, or let variable. 3440 // Local var, const, or let variable.
3459 if (mode == CONST_LEGACY && op == Token::INIT_CONST_LEGACY) { 3441 if (mode == CONST_LEGACY && op == Token::INIT_CONST_LEGACY) {
3460 // Perform an initialization check for legacy const variables. 3442 // Perform an initialization check for legacy const variables.
3461 Node* current = environment()->Lookup(variable); 3443 Node* current = environment()->Lookup(variable);
3462 if (current->op() != the_hole->op()) { 3444 if (current->op() != the_hole->op()) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
3559 Node* store = NewNode(op, value, current_context(), name, language); 3541 Node* store = NewNode(op, value, current_context(), name, language);
3560 PrepareFrameState(store, bailout_id, combine); 3542 PrepareFrameState(store, bailout_id, combine);
3561 return store; 3543 return store;
3562 } 3544 }
3563 } 3545 }
3564 UNREACHABLE(); 3546 UNREACHABLE();
3565 return NULL; 3547 return NULL;
3566 } 3548 }
3567 3549
3568 3550
3569 static inline Node* Record(JSTypeFeedbackTable* js_type_feedback, Node* node,
3570 FeedbackVectorSlot slot) {
3571 if (js_type_feedback) {
3572 js_type_feedback->Record(node, slot);
3573 }
3574 return node;
3575 }
3576
3577
3578 static inline Node* Record(JSTypeFeedbackTable* js_type_feedback, Node* node,
3579 TypeFeedbackId id) {
3580 if (js_type_feedback) {
3581 js_type_feedback->Record(node, id);
3582 }
3583 return node;
3584 }
3585
3586
3587 Node* AstGraphBuilder::BuildKeyedLoad(Node* object, Node* key, 3551 Node* AstGraphBuilder::BuildKeyedLoad(Node* object, Node* key,
3588 const VectorSlotPair& feedback) { 3552 const VectorSlotPair& feedback) {
3589 const Operator* op = javascript()->LoadProperty(language_mode(), feedback); 3553 const Operator* op = javascript()->LoadProperty(language_mode(), feedback);
3590 Node* node = NewNode(op, object, key, BuildLoadFeedbackVector()); 3554 Node* node = NewNode(op, object, key, BuildLoadFeedbackVector());
3591 return Record(js_type_feedback_, node, feedback.slot()); 3555 return node;
3592 } 3556 }
3593 3557
3594 3558
3595 Node* AstGraphBuilder::BuildNamedLoad(Node* object, Handle<Name> name, 3559 Node* AstGraphBuilder::BuildNamedLoad(Node* object, Handle<Name> name,
3596 const VectorSlotPair& feedback) { 3560 const VectorSlotPair& feedback) {
3597 const Operator* op = javascript()->LoadNamed(language_mode(), name, feedback); 3561 const Operator* op = javascript()->LoadNamed(language_mode(), name, feedback);
3598 Node* node = NewNode(op, object, BuildLoadFeedbackVector()); 3562 Node* node = NewNode(op, object, BuildLoadFeedbackVector());
3599 return Record(js_type_feedback_, node, feedback.slot()); 3563 return node;
3600 } 3564 }
3601 3565
3602 3566
3603 Node* AstGraphBuilder::BuildKeyedStore(Node* object, Node* key, Node* value, 3567 Node* AstGraphBuilder::BuildKeyedStore(Node* object, Node* key, Node* value,
3604 const VectorSlotPair& feedback, 3568 const VectorSlotPair& feedback) {
3605 TypeFeedbackId id) {
3606 const Operator* op = javascript()->StoreProperty(language_mode(), feedback); 3569 const Operator* op = javascript()->StoreProperty(language_mode(), feedback);
3607 Node* node = NewNode(op, object, key, value, BuildLoadFeedbackVector()); 3570 Node* node = NewNode(op, object, key, value, BuildLoadFeedbackVector());
3608 if (FLAG_vector_stores) { 3571 return node;
3609 return Record(js_type_feedback_, node, feedback.slot());
3610 }
3611 return Record(js_type_feedback_, node, id);
3612 } 3572 }
3613 3573
3614 3574
3615 Node* AstGraphBuilder::BuildNamedStore(Node* object, Handle<Name> name, 3575 Node* AstGraphBuilder::BuildNamedStore(Node* object, Handle<Name> name,
3616 Node* value, 3576 Node* value,
3617 const VectorSlotPair& feedback, 3577 const VectorSlotPair& feedback) {
3618 TypeFeedbackId id) {
3619 const Operator* op = 3578 const Operator* op =
3620 javascript()->StoreNamed(language_mode(), name, feedback); 3579 javascript()->StoreNamed(language_mode(), name, feedback);
3621 Node* node = NewNode(op, object, value, BuildLoadFeedbackVector()); 3580 Node* node = NewNode(op, object, value, BuildLoadFeedbackVector());
3622 if (FLAG_vector_stores) { 3581 return node;
3623 return Record(js_type_feedback_, node, feedback.slot());
3624 }
3625 return Record(js_type_feedback_, node, id);
3626 } 3582 }
3627 3583
3628 3584
3629 Node* AstGraphBuilder::BuildNamedSuperLoad(Node* receiver, Node* home_object, 3585 Node* AstGraphBuilder::BuildNamedSuperLoad(Node* receiver, Node* home_object,
3630 Handle<Name> name, 3586 Handle<Name> name,
3631 const VectorSlotPair& feedback) { 3587 const VectorSlotPair& feedback) {
3632 Node* name_node = jsgraph()->Constant(name); 3588 Node* name_node = jsgraph()->Constant(name);
3633 Node* language = jsgraph()->Constant(language_mode()); 3589 Node* language = jsgraph()->Constant(language_mode());
3634 const Operator* op = javascript()->CallRuntime(Runtime::kLoadFromSuper, 4); 3590 const Operator* op = javascript()->CallRuntime(Runtime::kLoadFromSuper, 4);
3635 Node* node = NewNode(op, receiver, home_object, name_node, language); 3591 Node* node = NewNode(op, receiver, home_object, name_node, language);
3636 return Record(js_type_feedback_, node, feedback.slot()); 3592 return node;
3637 } 3593 }
3638 3594
3639 3595
3640 Node* AstGraphBuilder::BuildKeyedSuperLoad(Node* receiver, Node* home_object, 3596 Node* AstGraphBuilder::BuildKeyedSuperLoad(Node* receiver, Node* home_object,
3641 Node* key, 3597 Node* key,
3642 const VectorSlotPair& feedback) { 3598 const VectorSlotPair& feedback) {
3643 Node* language = jsgraph()->Constant(language_mode()); 3599 Node* language = jsgraph()->Constant(language_mode());
3644 const Operator* op = 3600 const Operator* op =
3645 javascript()->CallRuntime(Runtime::kLoadKeyedFromSuper, 4); 3601 javascript()->CallRuntime(Runtime::kLoadKeyedFromSuper, 4);
3646 Node* node = NewNode(op, receiver, home_object, key, language); 3602 Node* node = NewNode(op, receiver, home_object, key, language);
3647 return Record(js_type_feedback_, node, feedback.slot()); 3603 return node;
3648 } 3604 }
3649 3605
3650 3606
3651 Node* AstGraphBuilder::BuildKeyedSuperStore(Node* receiver, Node* home_object, 3607 Node* AstGraphBuilder::BuildKeyedSuperStore(Node* receiver, Node* home_object,
3652 Node* key, Node* value, 3608 Node* key, Node* value) {
3653 TypeFeedbackId id) {
3654 Runtime::FunctionId function_id = is_strict(language_mode()) 3609 Runtime::FunctionId function_id = is_strict(language_mode())
3655 ? Runtime::kStoreKeyedToSuper_Strict 3610 ? Runtime::kStoreKeyedToSuper_Strict
3656 : Runtime::kStoreKeyedToSuper_Sloppy; 3611 : Runtime::kStoreKeyedToSuper_Sloppy;
3657 const Operator* op = javascript()->CallRuntime(function_id, 4); 3612 const Operator* op = javascript()->CallRuntime(function_id, 4);
3658 Node* node = NewNode(op, receiver, home_object, key, value); 3613 Node* node = NewNode(op, receiver, home_object, key, value);
3659 return Record(js_type_feedback_, node, id); 3614 return node;
3660 } 3615 }
3661 3616
3662 3617
3663 Node* AstGraphBuilder::BuildNamedSuperStore(Node* receiver, Node* home_object, 3618 Node* AstGraphBuilder::BuildNamedSuperStore(Node* receiver, Node* home_object,
3664 Handle<Name> name, Node* value, 3619 Handle<Name> name, Node* value) {
3665 TypeFeedbackId id) {
3666 Node* name_node = jsgraph()->Constant(name); 3620 Node* name_node = jsgraph()->Constant(name);
3667 Runtime::FunctionId function_id = is_strict(language_mode()) 3621 Runtime::FunctionId function_id = is_strict(language_mode())
3668 ? Runtime::kStoreToSuper_Strict 3622 ? Runtime::kStoreToSuper_Strict
3669 : Runtime::kStoreToSuper_Sloppy; 3623 : Runtime::kStoreToSuper_Sloppy;
3670 const Operator* op = javascript()->CallRuntime(function_id, 4); 3624 const Operator* op = javascript()->CallRuntime(function_id, 4);
3671 Node* node = NewNode(op, receiver, home_object, name_node, value); 3625 Node* node = NewNode(op, receiver, home_object, name_node, value);
3672 return Record(js_type_feedback_, node, id); 3626 return node;
3673 } 3627 }
3674 3628
3675 3629
3676 Node* AstGraphBuilder::BuildGlobalLoad(Handle<Name> name, 3630 Node* AstGraphBuilder::BuildGlobalLoad(Handle<Name> name,
3677 const VectorSlotPair& feedback, 3631 const VectorSlotPair& feedback,
3678 TypeofMode typeof_mode) { 3632 TypeofMode typeof_mode) {
3679 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode); 3633 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode);
3680 Node* node = NewNode(op, BuildLoadFeedbackVector()); 3634 Node* node = NewNode(op, BuildLoadFeedbackVector());
3681 return Record(js_type_feedback_, node, feedback.slot()); 3635 return node;
3682 } 3636 }
3683 3637
3684 3638
3685 Node* AstGraphBuilder::BuildGlobalStore(Handle<Name> name, Node* value, 3639 Node* AstGraphBuilder::BuildGlobalStore(Handle<Name> name, Node* value,
3686 const VectorSlotPair& feedback, 3640 const VectorSlotPair& feedback) {
3687 TypeFeedbackId id) {
3688 const Operator* op = 3641 const Operator* op =
3689 javascript()->StoreGlobal(language_mode(), name, feedback); 3642 javascript()->StoreGlobal(language_mode(), name, feedback);
3690 Node* node = NewNode(op, value, BuildLoadFeedbackVector()); 3643 Node* node = NewNode(op, value, BuildLoadFeedbackVector());
3691 if (FLAG_vector_stores) { 3644 return node;
3692 return Record(js_type_feedback_, node, feedback.slot());
3693 }
3694 return Record(js_type_feedback_, node, id);
3695 } 3645 }
3696 3646
3697 3647
3698 Node* AstGraphBuilder::BuildLoadObjectField(Node* object, int offset) { 3648 Node* AstGraphBuilder::BuildLoadObjectField(Node* object, int offset) {
3699 return NewNode(jsgraph()->machine()->Load(kMachAnyTagged), object, 3649 return NewNode(jsgraph()->machine()->Load(kMachAnyTagged), object,
3700 jsgraph()->IntPtrConstant(offset - kHeapObjectTag)); 3650 jsgraph()->IntPtrConstant(offset - kHeapObjectTag));
3701 } 3651 }
3702 3652
3703 3653
3704 Node* AstGraphBuilder::BuildLoadImmutableObjectField(Node* object, int offset) { 3654 Node* AstGraphBuilder::BuildLoadImmutableObjectField(Node* object, int offset) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
3813 3763
3814 Node* AstGraphBuilder::BuildSetHomeObject(Node* value, Node* home_object, 3764 Node* AstGraphBuilder::BuildSetHomeObject(Node* value, Node* home_object,
3815 ObjectLiteralProperty* property, 3765 ObjectLiteralProperty* property,
3816 int slot_number) { 3766 int slot_number) {
3817 Expression* expr = property->value(); 3767 Expression* expr = property->value();
3818 if (!FunctionLiteral::NeedsHomeObject(expr)) return value; 3768 if (!FunctionLiteral::NeedsHomeObject(expr)) return value;
3819 Handle<Name> name = isolate()->factory()->home_object_symbol(); 3769 Handle<Name> name = isolate()->factory()->home_object_symbol();
3820 FrameStateBeforeAndAfter states(this, BailoutId::None()); 3770 FrameStateBeforeAndAfter states(this, BailoutId::None());
3821 VectorSlotPair feedback = 3771 VectorSlotPair feedback =
3822 CreateVectorSlotPair(property->GetSlot(slot_number)); 3772 CreateVectorSlotPair(property->GetSlot(slot_number));
3823 Node* store = BuildNamedStore(value, name, home_object, feedback, 3773 Node* store = BuildNamedStore(value, name, home_object, feedback);
3824 TypeFeedbackId::None());
3825 states.AddToNode(store, BailoutId::None(), OutputFrameStateCombine::Ignore()); 3774 states.AddToNode(store, BailoutId::None(), OutputFrameStateCombine::Ignore());
3826 return store; 3775 return store;
3827 } 3776 }
3828 3777
3829 3778
3830 Node* AstGraphBuilder::BuildThrowError(Node* exception, BailoutId bailout_id) { 3779 Node* AstGraphBuilder::BuildThrowError(Node* exception, BailoutId bailout_id) {
3831 const Operator* op = javascript()->CallRuntime(Runtime::kThrow, 1); 3780 const Operator* op = javascript()->CallRuntime(Runtime::kThrow, 1);
3832 Node* call = NewNode(op, exception); 3781 Node* call = NewNode(op, exception);
3833 PrepareFrameState(call, bailout_id); 3782 PrepareFrameState(call, bailout_id);
3834 Node* control = NewNode(common()->Throw(), call); 3783 Node* control = NewNode(common()->Throw(), call);
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
4268 // Phi does not exist yet, introduce one. 4217 // Phi does not exist yet, introduce one.
4269 value = NewPhi(inputs, value, control); 4218 value = NewPhi(inputs, value, control);
4270 value->ReplaceInput(inputs - 1, other); 4219 value->ReplaceInput(inputs - 1, other);
4271 } 4220 }
4272 return value; 4221 return value;
4273 } 4222 }
4274 4223
4275 } // namespace compiler 4224 } // namespace compiler
4276 } // namespace internal 4225 } // namespace internal
4277 } // namespace v8 4226 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/compiler/js-type-feedback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698