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 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 DONT_CACHE_NODE(ModuleLiteral) | 1110 DONT_CACHE_NODE(ModuleLiteral) |
1111 | 1111 |
1112 | 1112 |
1113 void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) { | 1113 void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) { |
1114 increase_node_count(); | 1114 increase_node_count(); |
1115 if (node->is_jsruntime()) { | 1115 if (node->is_jsruntime()) { |
1116 // Don't try to inline JS runtime calls because we don't (currently) even | 1116 // Don't try to inline JS runtime calls because we don't (currently) even |
1117 // optimize them. | 1117 // optimize them. |
1118 add_flag(kDontInline); | 1118 add_flag(kDontInline); |
1119 } else if (node->function()->intrinsic_type == Runtime::INLINE && | 1119 } else if (node->function()->intrinsic_type == Runtime::INLINE && |
1120 (node->raw_name()->IsOneByteEqualTo("_ArgumentsLength") || | 1120 node->raw_name()->IsOneByteEqualTo("_Arguments")) { |
1121 node->raw_name()->IsOneByteEqualTo("_Arguments"))) { | 1121 // Don't inline the %_Arguments because it's implementation will not work. |
1122 // Don't inline the %_ArgumentsLength or %_Arguments because their | 1122 // There is no stack frame to get them from. |
1123 // implementation will not work. There is no stack frame to get them | |
1124 // from. | |
1125 add_flag(kDontInline); | 1123 add_flag(kDontInline); |
1126 } | 1124 } |
1127 } | 1125 } |
1128 | 1126 |
1129 #undef REGULAR_NODE | 1127 #undef REGULAR_NODE |
1130 #undef DONT_OPTIMIZE_NODE | 1128 #undef DONT_OPTIMIZE_NODE |
1131 #undef DONT_SELFOPTIMIZE_NODE | 1129 #undef DONT_SELFOPTIMIZE_NODE |
1132 #undef DONT_CACHE_NODE | 1130 #undef DONT_CACHE_NODE |
1133 | 1131 |
1134 | 1132 |
1135 Handle<String> Literal::ToString() { | 1133 Handle<String> Literal::ToString() { |
1136 if (value_->IsString()) return value_->AsString()->string(); | 1134 if (value_->IsString()) return value_->AsString()->string(); |
1137 ASSERT(value_->IsNumber()); | 1135 ASSERT(value_->IsNumber()); |
1138 char arr[100]; | 1136 char arr[100]; |
1139 Vector<char> buffer(arr, ARRAY_SIZE(arr)); | 1137 Vector<char> buffer(arr, ARRAY_SIZE(arr)); |
1140 const char* str; | 1138 const char* str; |
1141 if (value()->IsSmi()) { | 1139 if (value()->IsSmi()) { |
1142 // Optimization only, the heap number case would subsume this. | 1140 // Optimization only, the heap number case would subsume this. |
1143 SNPrintF(buffer, "%d", Smi::cast(*value())->value()); | 1141 SNPrintF(buffer, "%d", Smi::cast(*value())->value()); |
1144 str = arr; | 1142 str = arr; |
1145 } else { | 1143 } else { |
1146 str = DoubleToCString(value()->Number(), buffer); | 1144 str = DoubleToCString(value()->Number(), buffer); |
1147 } | 1145 } |
1148 return isolate_->factory()->NewStringFromAsciiChecked(str); | 1146 return isolate_->factory()->NewStringFromAsciiChecked(str); |
1149 } | 1147 } |
1150 | 1148 |
1151 | 1149 |
1152 } } // namespace v8::internal | 1150 } } // namespace v8::internal |
OLD | NEW |