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 <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/ast/ast-expression-visitor.h" | 10 #include "src/ast/ast-expression-visitor.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 i::Factory* factory = isolate->factory(); | 264 i::Factory* factory = isolate->factory(); |
265 | 265 |
266 i::Handle<i::String> source_code = | 266 i::Handle<i::String> source_code = |
267 factory->NewStringFromUtf8(i::CStrVector(test_function)) | 267 factory->NewStringFromUtf8(i::CStrVector(test_function)) |
268 .ToHandleChecked(); | 268 .ToHandleChecked(); |
269 | 269 |
270 i::Handle<i::Script> script = factory->NewScript(source_code); | 270 i::Handle<i::Script> script = factory->NewScript(source_code); |
271 | 271 |
272 i::ParseInfo info(handles.main_zone(), script); | 272 i::ParseInfo info(handles.main_zone(), script); |
273 i::Parser parser(&info); | 273 i::Parser parser(&info); |
274 parser.set_allow_harmony_sloppy(true); | |
275 info.set_global(); | 274 info.set_global(); |
276 info.set_lazy(false); | 275 info.set_lazy(false); |
277 info.set_allow_lazy_parsing(false); | 276 info.set_allow_lazy_parsing(false); |
278 info.set_toplevel(true); | 277 info.set_toplevel(true); |
279 | 278 |
280 CHECK(i::Compiler::ParseAndAnalyze(&info)); | 279 CHECK(i::Compiler::ParseAndAnalyze(&info)); |
281 FunctionLiteral* root = | 280 FunctionLiteral* root = |
282 info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun(); | 281 info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun(); |
283 | 282 |
284 // Core of the test. | 283 // Core of the test. |
285 ZoneVector<ExpressionTypeEntry> types(handles.main_zone()); | 284 ZoneVector<ExpressionTypeEntry> types(handles.main_zone()); |
286 ExpressionTypeCollector(isolate, root, &types).Run(); | 285 ExpressionTypeCollector(isolate, root, &types).Run(); |
287 CheckAllSame(types, Bounds::Unbounded()); | 286 CheckAllSame(types, Bounds::Unbounded()); |
288 | 287 |
289 TypeSetter(isolate, root).Run(); | 288 TypeSetter(isolate, root).Run(); |
290 | 289 |
291 ExpressionTypeCollector(isolate, root, &types).Run(); | 290 ExpressionTypeCollector(isolate, root, &types).Run(); |
292 CheckAllSame(types, INT32_TYPE); | 291 CheckAllSame(types, INT32_TYPE); |
293 | 292 |
294 TypingReseter(isolate, root).Run(); | 293 TypingReseter(isolate, root).Run(); |
295 | 294 |
296 ExpressionTypeCollector(isolate, root, &types).Run(); | 295 ExpressionTypeCollector(isolate, root, &types).Run(); |
297 CheckAllSame(types, Bounds::Unbounded()); | 296 CheckAllSame(types, Bounds::Unbounded()); |
298 } | 297 } |
OLD | NEW |