OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 position_(position), | 96 position_(position), |
97 interface_(interface) { | 97 interface_(interface) { |
98 // Names must be canonicalized for fast equality checks. | 98 // Names must be canonicalized for fast equality checks. |
99 ASSERT(name->IsSymbol()); | 99 ASSERT(name->IsSymbol()); |
100 } | 100 } |
101 | 101 |
102 | 102 |
103 void VariableProxy::BindTo(Variable* var) { | 103 void VariableProxy::BindTo(Variable* var) { |
104 ASSERT(var_ == NULL); // must be bound only once | 104 ASSERT(var_ == NULL); // must be bound only once |
105 ASSERT(var != NULL); // must bind | 105 ASSERT(var != NULL); // must bind |
| 106 ASSERT(!FLAG_harmony_modules || interface_->IsUnified(var->interface())); |
106 ASSERT((is_this() && var->is_this()) || name_.is_identical_to(var->name())); | 107 ASSERT((is_this() && var->is_this()) || name_.is_identical_to(var->name())); |
107 // Ideally CONST-ness should match. However, this is very hard to achieve | 108 // Ideally CONST-ness should match. However, this is very hard to achieve |
108 // because we don't know the exact semantics of conflicting (const and | 109 // because we don't know the exact semantics of conflicting (const and |
109 // non-const) multiple variable declarations, const vars introduced via | 110 // non-const) multiple variable declarations, const vars introduced via |
110 // eval() etc. Const-ness and variable declarations are a complete mess | 111 // eval() etc. Const-ness and variable declarations are a complete mess |
111 // in JS. Sigh... | 112 // in JS. Sigh... |
112 var_ = var; | 113 var_ = var; |
113 var->set_is_used(true); | 114 var->set_is_used(true); |
114 } | 115 } |
115 | 116 |
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 REGULAR_NODE(CompareOperation) | 1064 REGULAR_NODE(CompareOperation) |
1064 REGULAR_NODE(ThisFunction) | 1065 REGULAR_NODE(ThisFunction) |
1065 REGULAR_NODE(Call) | 1066 REGULAR_NODE(Call) |
1066 REGULAR_NODE(CallNew) | 1067 REGULAR_NODE(CallNew) |
1067 // In theory, for VariableProxy we'd have to add: | 1068 // In theory, for VariableProxy we'd have to add: |
1068 // if (node->var()->IsLookupSlot()) add_flag(kDontInline); | 1069 // if (node->var()->IsLookupSlot()) add_flag(kDontInline); |
1069 // But node->var() is usually not bound yet at VariableProxy creation time, and | 1070 // But node->var() is usually not bound yet at VariableProxy creation time, and |
1070 // LOOKUP variables only result from constructs that cannot be inlined anyway. | 1071 // LOOKUP variables only result from constructs that cannot be inlined anyway. |
1071 REGULAR_NODE(VariableProxy) | 1072 REGULAR_NODE(VariableProxy) |
1072 | 1073 |
1073 // We currently do not optimize any modules. Note in particular, that module | 1074 // We currently do not optimize any modules. |
1074 // instance objects associated with ModuleLiterals are allocated during | |
1075 // scope resolution, and references to them are embedded into the code. | |
1076 // That code may hence neither be cached nor re-compiled. | |
1077 DONT_OPTIMIZE_NODE(ModuleDeclaration) | 1075 DONT_OPTIMIZE_NODE(ModuleDeclaration) |
1078 DONT_OPTIMIZE_NODE(ImportDeclaration) | 1076 DONT_OPTIMIZE_NODE(ImportDeclaration) |
1079 DONT_OPTIMIZE_NODE(ExportDeclaration) | 1077 DONT_OPTIMIZE_NODE(ExportDeclaration) |
1080 DONT_OPTIMIZE_NODE(ModuleVariable) | 1078 DONT_OPTIMIZE_NODE(ModuleVariable) |
1081 DONT_OPTIMIZE_NODE(ModulePath) | 1079 DONT_OPTIMIZE_NODE(ModulePath) |
1082 DONT_OPTIMIZE_NODE(ModuleUrl) | 1080 DONT_OPTIMIZE_NODE(ModuleUrl) |
| 1081 DONT_OPTIMIZE_NODE(ModuleStatement) |
1083 DONT_OPTIMIZE_NODE(WithStatement) | 1082 DONT_OPTIMIZE_NODE(WithStatement) |
1084 DONT_OPTIMIZE_NODE(TryCatchStatement) | 1083 DONT_OPTIMIZE_NODE(TryCatchStatement) |
1085 DONT_OPTIMIZE_NODE(TryFinallyStatement) | 1084 DONT_OPTIMIZE_NODE(TryFinallyStatement) |
1086 DONT_OPTIMIZE_NODE(DebuggerStatement) | 1085 DONT_OPTIMIZE_NODE(DebuggerStatement) |
1087 DONT_OPTIMIZE_NODE(SharedFunctionInfoLiteral) | 1086 DONT_OPTIMIZE_NODE(SharedFunctionInfoLiteral) |
1088 | 1087 |
1089 DONT_INLINE_NODE(ArrayLiteral) // TODO(1322): Allow materialized literals. | 1088 DONT_INLINE_NODE(ArrayLiteral) // TODO(1322): Allow materialized literals. |
1090 DONT_INLINE_NODE(FunctionLiteral) | 1089 DONT_INLINE_NODE(FunctionLiteral) |
1091 | 1090 |
1092 DONT_SELFOPTIMIZE_NODE(DoWhileStatement) | 1091 DONT_SELFOPTIMIZE_NODE(DoWhileStatement) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 OS::SNPrintF(buffer, "%d", Smi::cast(*handle_)->value()); | 1129 OS::SNPrintF(buffer, "%d", Smi::cast(*handle_)->value()); |
1131 str = arr; | 1130 str = arr; |
1132 } else { | 1131 } else { |
1133 str = DoubleToCString(handle_->Number(), buffer); | 1132 str = DoubleToCString(handle_->Number(), buffer); |
1134 } | 1133 } |
1135 return FACTORY->NewStringFromAscii(CStrVector(str)); | 1134 return FACTORY->NewStringFromAscii(CStrVector(str)); |
1136 } | 1135 } |
1137 | 1136 |
1138 | 1137 |
1139 } } // namespace v8::internal | 1138 } } // namespace v8::internal |
OLD | NEW |