OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/api.h" | 5 #include "src/api.h" |
6 #include "src/api-natives.h" | 6 #include "src/api-natives.h" |
7 #include "src/assert-scope.h" | 7 #include "src/assert-scope.h" |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/factory.h" | 10 #include "src/factory.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 i::ParseInfo* info, i::Handle<i::Object> foreign, ErrorThrower* thrower) { | 127 i::ParseInfo* info, i::Handle<i::Object> foreign, ErrorThrower* thrower) { |
128 info->set_global(); | 128 info->set_global(); |
129 info->set_lazy(false); | 129 info->set_lazy(false); |
130 info->set_allow_lazy_parsing(false); | 130 info->set_allow_lazy_parsing(false); |
131 info->set_toplevel(true); | 131 info->set_toplevel(true); |
132 | 132 |
133 if (!i::Compiler::ParseAndAnalyze(info)) { | 133 if (!i::Compiler::ParseAndAnalyze(info)) { |
134 return nullptr; | 134 return nullptr; |
135 } | 135 } |
136 | 136 |
| 137 if (info->scope()->declarations()->length() == 0) { |
| 138 thrower->Error("Asm.js validation failed: no declarations in scope"); |
| 139 return nullptr; |
| 140 } |
| 141 |
137 info->set_literal( | 142 info->set_literal( |
138 info->scope()->declarations()->at(0)->AsFunctionDeclaration()->fun()); | 143 info->scope()->declarations()->at(0)->AsFunctionDeclaration()->fun()); |
139 | 144 |
140 v8::internal::AsmTyper typer(info->isolate(), info->zone(), *(info->script()), | 145 v8::internal::AsmTyper typer(info->isolate(), info->zone(), *(info->script()), |
141 info->literal()); | 146 info->literal()); |
142 if (i::FLAG_enable_simd_asmjs) { | 147 if (i::FLAG_enable_simd_asmjs) { |
143 typer.set_allow_simd(true); | 148 typer.set_allow_simd(true); |
144 } | 149 } |
145 if (!typer.Validate()) { | 150 if (!typer.Validate()) { |
146 thrower->Error("Asm.js validation failed: %s", typer.error_message()); | 151 thrower->Error("Asm.js validation failed: %s", typer.error_message()); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 int unused_property_fields = in_object_properties - pre_allocated; | 331 int unused_property_fields = in_object_properties - pre_allocated; |
327 Handle<Map> map = Map::CopyInitialMap( | 332 Handle<Map> map = Map::CopyInitialMap( |
328 prev_map, instance_size, in_object_properties, unused_property_fields); | 333 prev_map, instance_size, in_object_properties, unused_property_fields); |
329 | 334 |
330 context->set_wasm_function_map(*map); | 335 context->set_wasm_function_map(*map); |
331 } | 336 } |
332 } | 337 } |
333 | 338 |
334 } // namespace internal | 339 } // namespace internal |
335 } // namespace v8 | 340 } // namespace v8 |
OLD | NEW |