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