| 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/ast.h" | 5 #include "src/ast.h" |
| 6 | 6 |
| 7 #include <cmath> // For isfinite. | 7 #include <cmath> // For isfinite. |
| 8 #include "src/builtins.h" | 8 #include "src/builtins.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/contexts.h" | 10 #include "src/contexts.h" |
| (...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 label_(label), | 999 label_(label), |
| 1000 statements_(statements), | 1000 statements_(statements), |
| 1001 compare_type_(Type::None(zone)) {} | 1001 compare_type_(Type::None(zone)) {} |
| 1002 | 1002 |
| 1003 | 1003 |
| 1004 #define REGULAR_NODE(NodeType) \ | 1004 #define REGULAR_NODE(NodeType) \ |
| 1005 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ | 1005 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
| 1006 } | 1006 } |
| 1007 #define REGULAR_NODE_WITH_FEEDBACK_SLOTS(NodeType) \ | 1007 #define REGULAR_NODE_WITH_FEEDBACK_SLOTS(NodeType) \ |
| 1008 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ | 1008 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
| 1009 add_slot_node(node); \ | |
| 1010 } | 1009 } |
| 1011 #define DONT_OPTIMIZE_NODE(NodeType) \ | 1010 #define DONT_OPTIMIZE_NODE(NodeType) \ |
| 1012 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ | 1011 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
| 1013 } | 1012 } |
| 1014 #define DONT_OPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \ | 1013 #define DONT_OPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \ |
| 1015 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ | 1014 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
| 1016 add_slot_node(node); \ | |
| 1017 } | 1015 } |
| 1018 #define DONT_TURBOFAN_NODE(NodeType) \ | 1016 #define DONT_TURBOFAN_NODE(NodeType) \ |
| 1019 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ | 1017 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
| 1020 } | 1018 } |
| 1021 #define DONT_TURBOFAN_NODE_WITH_FEEDBACK_SLOTS(NodeType) \ | 1019 #define DONT_TURBOFAN_NODE_WITH_FEEDBACK_SLOTS(NodeType) \ |
| 1022 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ | 1020 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
| 1023 add_slot_node(node); \ | |
| 1024 } | 1021 } |
| 1025 #define DONT_SELFOPTIMIZE_NODE(NodeType) \ | 1022 #define DONT_SELFOPTIMIZE_NODE(NodeType) \ |
| 1026 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ | 1023 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
| 1027 } | 1024 } |
| 1028 #define DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \ | 1025 #define DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(NodeType) \ |
| 1029 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ | 1026 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
| 1030 add_slot_node(node); \ | |
| 1031 } | 1027 } |
| 1032 #define DONT_CACHE_NODE(NodeType) \ | 1028 #define DONT_CACHE_NODE(NodeType) \ |
| 1033 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ | 1029 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
| 1034 } | 1030 } |
| 1035 | 1031 |
| 1036 REGULAR_NODE(VariableDeclaration) | 1032 REGULAR_NODE(VariableDeclaration) |
| 1037 REGULAR_NODE(FunctionDeclaration) | 1033 REGULAR_NODE(FunctionDeclaration) |
| 1038 REGULAR_NODE(Block) | 1034 REGULAR_NODE(Block) |
| 1039 REGULAR_NODE(ExpressionStatement) | 1035 REGULAR_NODE(ExpressionStatement) |
| 1040 REGULAR_NODE(EmptyStatement) | 1036 REGULAR_NODE(EmptyStatement) |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 DONT_SELFOPTIMIZE_NODE(DoWhileStatement) | 1090 DONT_SELFOPTIMIZE_NODE(DoWhileStatement) |
| 1095 DONT_SELFOPTIMIZE_NODE(WhileStatement) | 1091 DONT_SELFOPTIMIZE_NODE(WhileStatement) |
| 1096 DONT_SELFOPTIMIZE_NODE(ForStatement) | 1092 DONT_SELFOPTIMIZE_NODE(ForStatement) |
| 1097 | 1093 |
| 1098 DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(ForInStatement) | 1094 DONT_SELFOPTIMIZE_NODE_WITH_FEEDBACK_SLOTS(ForInStatement) |
| 1099 | 1095 |
| 1100 DONT_CACHE_NODE(ModuleLiteral) | 1096 DONT_CACHE_NODE(ModuleLiteral) |
| 1101 | 1097 |
| 1102 | 1098 |
| 1103 void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) { | 1099 void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) { |
| 1104 add_slot_node(node); | |
| 1105 } | 1100 } |
| 1106 | 1101 |
| 1107 #undef REGULAR_NODE | 1102 #undef REGULAR_NODE |
| 1108 #undef DONT_OPTIMIZE_NODE | 1103 #undef DONT_OPTIMIZE_NODE |
| 1109 #undef DONT_SELFOPTIMIZE_NODE | 1104 #undef DONT_SELFOPTIMIZE_NODE |
| 1110 #undef DONT_CACHE_NODE | 1105 #undef DONT_CACHE_NODE |
| 1111 | 1106 |
| 1112 | 1107 |
| 1113 uint32_t Literal::Hash() { | 1108 uint32_t Literal::Hash() { |
| 1114 return raw_value()->IsString() | 1109 return raw_value()->IsString() |
| 1115 ? raw_value()->AsString()->hash() | 1110 ? raw_value()->AsString()->hash() |
| 1116 : ComputeLongHash(double_to_uint64(raw_value()->AsNumber())); | 1111 : ComputeLongHash(double_to_uint64(raw_value()->AsNumber())); |
| 1117 } | 1112 } |
| 1118 | 1113 |
| 1119 | 1114 |
| 1120 // static | 1115 // static |
| 1121 bool Literal::Match(void* literal1, void* literal2) { | 1116 bool Literal::Match(void* literal1, void* literal2) { |
| 1122 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1117 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
| 1123 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1118 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
| 1124 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || | 1119 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || |
| 1125 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1120 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
| 1126 } | 1121 } |
| 1127 | 1122 |
| 1128 | 1123 |
| 1129 } } // namespace v8::internal | 1124 } } // namespace v8::internal |
| OLD | NEW |