OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/scopes.h" | 5 #include "src/ast/scopes.h" |
6 #include "src/compilation-info.h" | 6 #include "src/compilation-info.h" |
7 #include "src/compiler/ast-loop-assignment-analyzer.h" | 7 #include "src/compiler/ast-loop-assignment-analyzer.h" |
8 #include "src/objects-inl.h" | 8 #include "src/objects-inl.h" |
9 #include "src/parsing/parse-info.h" | 9 #include "src/parsing/parse-info.h" |
10 #include "src/parsing/parsing.h" | 10 #include "src/parsing/parsing.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 ScopedVector<char> program(kBufferSize); | 27 ScopedVector<char> program(kBufferSize); |
28 SNPrintF(program, "function f(a,b,c) { %s; } f;", body); | 28 SNPrintF(program, "function f(a,b,c) { %s; } f;", body); |
29 v8::Local<v8::Value> v = CompileRun(program.start()); | 29 v8::Local<v8::Value> v = CompileRun(program.start()); |
30 Handle<Object> obj = v8::Utils::OpenHandle(*v); | 30 Handle<Object> obj = v8::Utils::OpenHandle(*v); |
31 function = Handle<JSFunction>::cast(obj); | 31 function = Handle<JSFunction>::cast(obj); |
32 } | 32 } |
33 | 33 |
34 void CheckLoopAssignedCount(int expected, const char* var_name) { | 34 void CheckLoopAssignedCount(int expected, const char* var_name) { |
35 // TODO(titzer): don't scope analyze every single time. | 35 // TODO(titzer): don't scope analyze every single time. |
36 ParseInfo parse_info(handle(function->shared())); | 36 ParseInfo parse_info(handle(function->shared())); |
37 CompilationInfo info(&parse_info, function); | 37 CompilationInfo info(parse_info.zone(), &parse_info, function); |
38 | 38 |
39 CHECK(parsing::ParseFunction(&parse_info)); | 39 CHECK(parsing::ParseFunction(&parse_info)); |
40 CHECK(Rewriter::Rewrite(&parse_info)); | 40 CHECK(Rewriter::Rewrite(&parse_info)); |
41 DeclarationScope::Analyze(&parse_info, AnalyzeMode::kRegular); | 41 DeclarationScope::Analyze(&parse_info, AnalyzeMode::kRegular); |
42 | 42 |
43 DeclarationScope* scope = info.literal()->scope(); | 43 DeclarationScope* scope = info.literal()->scope(); |
44 AstValueFactory* factory = parse_info.ast_value_factory(); | 44 AstValueFactory* factory = parse_info.ast_value_factory(); |
45 CHECK(scope); | 45 CHECK(scope); |
46 | 46 |
47 if (result == NULL) { | 47 if (result == NULL) { |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 275 |
276 f.CheckLoopAssignedCount(1, "x"); | 276 f.CheckLoopAssignedCount(1, "x"); |
277 f.CheckLoopAssignedCount(3, "y"); | 277 f.CheckLoopAssignedCount(3, "y"); |
278 f.CheckLoopAssignedCount(5, "z"); | 278 f.CheckLoopAssignedCount(5, "z"); |
279 f.CheckLoopAssignedCount(0, "w"); | 279 f.CheckLoopAssignedCount(0, "w"); |
280 } | 280 } |
281 | 281 |
282 } // namespace compiler | 282 } // namespace compiler |
283 } // namespace internal | 283 } // namespace internal |
284 } // namespace v8 | 284 } // namespace v8 |
OLD | NEW |