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

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

Issue 473263004: Towards removing dependency from generic lowering on compilation info. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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
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/control-builders.h" 8 #include "src/compiler/control-builders.h"
9 #include "src/compiler/node-properties.h" 9 #include "src/compiler/node-properties.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 // Fall through. 924 // Fall through.
925 case ObjectLiteral::Property::COMPUTED: { 925 case ObjectLiteral::Property::COMPUTED: {
926 // It is safe to use [[Put]] here because the boilerplate already 926 // It is safe to use [[Put]] here because the boilerplate already
927 // contains computed properties with an uninitialized value. 927 // contains computed properties with an uninitialized value.
928 if (key->value()->IsInternalizedString()) { 928 if (key->value()->IsInternalizedString()) {
929 if (property->emit_store()) { 929 if (property->emit_store()) {
930 VisitForValue(property->value()); 930 VisitForValue(property->value());
931 Node* value = environment()->Pop(); 931 Node* value = environment()->Pop();
932 PrintableUnique<Name> name = MakeUnique(key->AsPropertyName()); 932 PrintableUnique<Name> name = MakeUnique(key->AsPropertyName());
933 Node* store = 933 Node* store =
934 NewNode(javascript()->StoreNamed(name), literal, value); 934 NewNode(javascript()->StoreNamed(info()->strict_mode(), name),
935 literal, value);
935 BuildLazyBailout(store, key->id()); 936 BuildLazyBailout(store, key->id());
936 } else { 937 } else {
937 VisitForEffect(property->value()); 938 VisitForEffect(property->value());
938 } 939 }
939 break; 940 break;
940 } 941 }
941 environment()->Push(literal); // Duplicate receiver. 942 environment()->Push(literal); // Duplicate receiver.
942 VisitForValue(property->key()); 943 VisitForValue(property->key());
943 VisitForValue(property->value()); 944 VisitForValue(property->value());
944 Node* value = environment()->Pop(); 945 Node* value = environment()->Pop();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 1017
1017 // Create nodes to evaluate all the non-constant subexpressions and to store 1018 // Create nodes to evaluate all the non-constant subexpressions and to store
1018 // them into the newly cloned array. 1019 // them into the newly cloned array.
1019 for (int i = 0; i < expr->values()->length(); i++) { 1020 for (int i = 0; i < expr->values()->length(); i++) {
1020 Expression* subexpr = expr->values()->at(i); 1021 Expression* subexpr = expr->values()->at(i);
1021 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; 1022 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue;
1022 1023
1023 VisitForValue(subexpr); 1024 VisitForValue(subexpr);
1024 Node* value = environment()->Pop(); 1025 Node* value = environment()->Pop();
1025 Node* index = jsgraph()->Constant(i); 1026 Node* index = jsgraph()->Constant(i);
1026 Node* store = NewNode(javascript()->StoreProperty(), literal, index, value); 1027 Node* store = NewNode(javascript()->StoreProperty(info()->strict_mode()),
1028 literal, index, value);
1027 BuildLazyBailout(store, expr->GetIdForElement(i)); 1029 BuildLazyBailout(store, expr->GetIdForElement(i));
1028 } 1030 }
1029 1031
1030 environment()->Pop(); // Array literal index. 1032 environment()->Pop(); // Array literal index.
1031 ast_context()->ProduceValue(environment()->Pop()); 1033 ast_context()->ProduceValue(environment()->Pop());
1032 } 1034 }
1033 1035
1034 1036
1035 void AstGraphBuilder::VisitForInAssignment(Expression* expr, Node* value) { 1037 void AstGraphBuilder::VisitForInAssignment(Expression* expr, Node* value) {
1036 DCHECK(expr->IsValidReferenceExpression()); 1038 DCHECK(expr->IsValidReferenceExpression());
(...skipping 10 matching lines...) Expand all
1047 BuildVariableAssignment(var, value, Token::ASSIGN, BailoutId::None()); 1049 BuildVariableAssignment(var, value, Token::ASSIGN, BailoutId::None());
1048 break; 1050 break;
1049 } 1051 }
1050 case NAMED_PROPERTY: { 1052 case NAMED_PROPERTY: {
1051 environment()->Push(value); 1053 environment()->Push(value);
1052 VisitForValue(property->obj()); 1054 VisitForValue(property->obj());
1053 Node* object = environment()->Pop(); 1055 Node* object = environment()->Pop();
1054 value = environment()->Pop(); 1056 value = environment()->Pop();
1055 PrintableUnique<Name> name = 1057 PrintableUnique<Name> name =
1056 MakeUnique(property->key()->AsLiteral()->AsPropertyName()); 1058 MakeUnique(property->key()->AsLiteral()->AsPropertyName());
1057 Node* store = NewNode(javascript()->StoreNamed(name), object, value); 1059 Node* store = NewNode(
1060 javascript()->StoreNamed(info()->strict_mode(), name), object, value);
1058 // TODO(jarin) Fill in the correct bailout id. 1061 // TODO(jarin) Fill in the correct bailout id.
1059 BuildLazyBailout(store, BailoutId::None()); 1062 BuildLazyBailout(store, BailoutId::None());
1060 break; 1063 break;
1061 } 1064 }
1062 case KEYED_PROPERTY: { 1065 case KEYED_PROPERTY: {
1063 environment()->Push(value); 1066 environment()->Push(value);
1064 VisitForValue(property->obj()); 1067 VisitForValue(property->obj());
1065 VisitForValue(property->key()); 1068 VisitForValue(property->key());
1066 Node* key = environment()->Pop(); 1069 Node* key = environment()->Pop();
1067 Node* object = environment()->Pop(); 1070 Node* object = environment()->Pop();
1068 value = environment()->Pop(); 1071 value = environment()->Pop();
1069 Node* store = NewNode(javascript()->StoreProperty(), object, key, value); 1072 Node* store = NewNode(javascript()->StoreProperty(info()->strict_mode()),
1073 object, key, value);
1070 // TODO(jarin) Fill in the correct bailout id. 1074 // TODO(jarin) Fill in the correct bailout id.
1071 BuildLazyBailout(store, BailoutId::None()); 1075 BuildLazyBailout(store, BailoutId::None());
1072 break; 1076 break;
1073 } 1077 }
1074 } 1078 }
1075 } 1079 }
1076 1080
1077 1081
1078 void AstGraphBuilder::VisitAssignment(Assignment* expr) { 1082 void AstGraphBuilder::VisitAssignment(Assignment* expr) {
1079 DCHECK(expr->target()->IsValidReferenceExpression()); 1083 DCHECK(expr->target()->IsValidReferenceExpression());
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 case VARIABLE: { 1144 case VARIABLE: {
1141 Variable* variable = expr->target()->AsVariableProxy()->var(); 1145 Variable* variable = expr->target()->AsVariableProxy()->var();
1142 BuildVariableAssignment(variable, value, expr->op(), 1146 BuildVariableAssignment(variable, value, expr->op(),
1143 expr->AssignmentId()); 1147 expr->AssignmentId());
1144 break; 1148 break;
1145 } 1149 }
1146 case NAMED_PROPERTY: { 1150 case NAMED_PROPERTY: {
1147 Node* object = environment()->Pop(); 1151 Node* object = environment()->Pop();
1148 PrintableUnique<Name> name = 1152 PrintableUnique<Name> name =
1149 MakeUnique(property->key()->AsLiteral()->AsPropertyName()); 1153 MakeUnique(property->key()->AsLiteral()->AsPropertyName());
1150 Node* store = NewNode(javascript()->StoreNamed(name), object, value); 1154 Node* store = NewNode(
1155 javascript()->StoreNamed(info()->strict_mode(), name), object, value);
1151 BuildLazyBailout(store, expr->AssignmentId()); 1156 BuildLazyBailout(store, expr->AssignmentId());
1152 break; 1157 break;
1153 } 1158 }
1154 case KEYED_PROPERTY: { 1159 case KEYED_PROPERTY: {
1155 Node* key = environment()->Pop(); 1160 Node* key = environment()->Pop();
1156 Node* object = environment()->Pop(); 1161 Node* object = environment()->Pop();
1157 Node* store = NewNode(javascript()->StoreProperty(), object, key, value); 1162 Node* store = NewNode(javascript()->StoreProperty(info()->strict_mode()),
1163 object, key, value);
1158 BuildLazyBailout(store, expr->AssignmentId()); 1164 BuildLazyBailout(store, expr->AssignmentId());
1159 break; 1165 break;
1160 } 1166 }
1161 } 1167 }
1162 1168
1163 ast_context()->ProduceValue(value); 1169 ast_context()->ProduceValue(value);
1164 } 1170 }
1165 1171
1166 1172
1167 void AstGraphBuilder::VisitYield(Yield* expr) { 1173 void AstGraphBuilder::VisitYield(Yield* expr) {
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1440 case VARIABLE: { 1446 case VARIABLE: {
1441 Variable* variable = expr->expression()->AsVariableProxy()->var(); 1447 Variable* variable = expr->expression()->AsVariableProxy()->var();
1442 BuildVariableAssignment(variable, value, expr->op(), 1448 BuildVariableAssignment(variable, value, expr->op(),
1443 expr->AssignmentId()); 1449 expr->AssignmentId());
1444 break; 1450 break;
1445 } 1451 }
1446 case NAMED_PROPERTY: { 1452 case NAMED_PROPERTY: {
1447 Node* object = environment()->Pop(); 1453 Node* object = environment()->Pop();
1448 PrintableUnique<Name> name = 1454 PrintableUnique<Name> name =
1449 MakeUnique(property->key()->AsLiteral()->AsPropertyName()); 1455 MakeUnique(property->key()->AsLiteral()->AsPropertyName());
1450 Node* store = NewNode(javascript()->StoreNamed(name), object, value); 1456 Node* store = NewNode(
1457 javascript()->StoreNamed(info()->strict_mode(), name), object, value);
1451 BuildLazyBailout(store, expr->AssignmentId()); 1458 BuildLazyBailout(store, expr->AssignmentId());
1452 break; 1459 break;
1453 } 1460 }
1454 case KEYED_PROPERTY: { 1461 case KEYED_PROPERTY: {
1455 Node* key = environment()->Pop(); 1462 Node* key = environment()->Pop();
1456 Node* object = environment()->Pop(); 1463 Node* object = environment()->Pop();
1457 Node* store = NewNode(javascript()->StoreProperty(), object, key, value); 1464 Node* store = NewNode(javascript()->StoreProperty(info()->strict_mode()),
1465 object, key, value);
1458 BuildLazyBailout(store, expr->AssignmentId()); 1466 BuildLazyBailout(store, expr->AssignmentId());
1459 break; 1467 break;
1460 } 1468 }
1461 } 1469 }
1462 1470
1463 // Restore old value for postfix expressions. 1471 // Restore old value for postfix expressions.
1464 if (is_postfix) value = environment()->Pop(); 1472 if (is_postfix) value = environment()->Pop();
1465 1473
1466 ast_context()->ProduceValue(value); 1474 ast_context()->ProduceValue(value);
1467 } 1475 }
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
1857 Node* AstGraphBuilder::BuildVariableAssignment(Variable* variable, Node* value, 1865 Node* AstGraphBuilder::BuildVariableAssignment(Variable* variable, Node* value,
1858 Token::Value op, 1866 Token::Value op,
1859 BailoutId bailout_id) { 1867 BailoutId bailout_id) {
1860 Node* the_hole = jsgraph()->TheHoleConstant(); 1868 Node* the_hole = jsgraph()->TheHoleConstant();
1861 VariableMode mode = variable->mode(); 1869 VariableMode mode = variable->mode();
1862 switch (variable->location()) { 1870 switch (variable->location()) {
1863 case Variable::UNALLOCATED: { 1871 case Variable::UNALLOCATED: {
1864 // Global var, const, or let variable. 1872 // Global var, const, or let variable.
1865 Node* global = BuildLoadGlobalObject(); 1873 Node* global = BuildLoadGlobalObject();
1866 PrintableUnique<Name> name = MakeUnique(variable->name()); 1874 PrintableUnique<Name> name = MakeUnique(variable->name());
1867 Operator* op = javascript()->StoreNamed(name); 1875 Operator* op = javascript()->StoreNamed(info()->strict_mode(), name);
1868 Node* store = NewNode(op, global, value); 1876 Node* store = NewNode(op, global, value);
1869 BuildLazyBailout(store, bailout_id); 1877 BuildLazyBailout(store, bailout_id);
1870 return store; 1878 return store;
1871 } 1879 }
1872 case Variable::PARAMETER: 1880 case Variable::PARAMETER:
1873 case Variable::LOCAL: 1881 case Variable::LOCAL:
1874 // Local var, const, or let variable. 1882 // Local var, const, or let variable.
1875 if (mode == CONST_LEGACY && op == Token::INIT_CONST_LEGACY) { 1883 if (mode == CONST_LEGACY && op == Token::INIT_CONST_LEGACY) {
1876 // Perform an initialization check for legacy const variables. 1884 // Perform an initialization check for legacy const variables.
1877 Node* current = environment()->Lookup(variable); 1885 Node* current = environment()->Lookup(variable);
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
2051 2059
2052 void AstGraphBuilder::BuildLazyBailoutWithPushedNode(Node* node, 2060 void AstGraphBuilder::BuildLazyBailoutWithPushedNode(Node* node,
2053 BailoutId ast_id) { 2061 BailoutId ast_id) {
2054 environment()->Push(node); 2062 environment()->Push(node);
2055 BuildLazyBailout(node, ast_id); 2063 BuildLazyBailout(node, ast_id);
2056 environment()->Pop(); 2064 environment()->Pop();
2057 } 2065 }
2058 } 2066 }
2059 } 2067 }
2060 } // namespace v8::internal::compiler 2068 } // namespace v8::internal::compiler
OLDNEW
« no previous file with comments | « no previous file | src/compiler/js-context-specialization.h » ('j') | src/compiler/js-context-specialization.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698