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 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 | 1109 |
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 && | |
1120 node->raw_name()->IsOneByteEqualTo("_Arguments")) { | |
1121 // Don't inline the %_Arguments because it's implementation will not work. | |
1122 // There is no stack frame to get them from. | |
1123 add_flag(kDontInline); | |
1124 } | 1119 } |
1125 } | 1120 } |
1126 | 1121 |
1127 #undef REGULAR_NODE | 1122 #undef REGULAR_NODE |
1128 #undef DONT_OPTIMIZE_NODE | 1123 #undef DONT_OPTIMIZE_NODE |
1129 #undef DONT_SELFOPTIMIZE_NODE | 1124 #undef DONT_SELFOPTIMIZE_NODE |
1130 #undef DONT_CACHE_NODE | 1125 #undef DONT_CACHE_NODE |
1131 | 1126 |
1132 | 1127 |
1133 Handle<String> Literal::ToString() { | 1128 Handle<String> Literal::ToString() { |
1134 if (value_->IsString()) return value_->AsString()->string(); | 1129 if (value_->IsString()) return value_->AsString()->string(); |
1135 ASSERT(value_->IsNumber()); | 1130 ASSERT(value_->IsNumber()); |
1136 char arr[100]; | 1131 char arr[100]; |
1137 Vector<char> buffer(arr, ARRAY_SIZE(arr)); | 1132 Vector<char> buffer(arr, ARRAY_SIZE(arr)); |
1138 const char* str; | 1133 const char* str; |
1139 if (value()->IsSmi()) { | 1134 if (value()->IsSmi()) { |
1140 // Optimization only, the heap number case would subsume this. | 1135 // Optimization only, the heap number case would subsume this. |
1141 SNPrintF(buffer, "%d", Smi::cast(*value())->value()); | 1136 SNPrintF(buffer, "%d", Smi::cast(*value())->value()); |
1142 str = arr; | 1137 str = arr; |
1143 } else { | 1138 } else { |
1144 str = DoubleToCString(value()->Number(), buffer); | 1139 str = DoubleToCString(value()->Number(), buffer); |
1145 } | 1140 } |
1146 return isolate_->factory()->NewStringFromAsciiChecked(str); | 1141 return isolate_->factory()->NewStringFromAsciiChecked(str); |
1147 } | 1142 } |
1148 | 1143 |
1149 | 1144 |
1150 } } // namespace v8::internal | 1145 } } // namespace v8::internal |
OLD | NEW |