OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 // Test specific cases of the lazy/eager-parse decision. | 5 // Test specific cases of the lazy/eager-parse decision. |
6 // | 6 // |
7 // Note that presently most unit tests for parsing are found in | 7 // Note that presently most unit tests for parsing are found in |
8 // cctest/test-parsing.cc. | 8 // cctest/test-parsing.cc. |
9 | 9 |
10 #include <unordered_map> | 10 #include <unordered_map> |
11 | 11 |
12 #include "include/v8.h" | 12 #include "include/v8.h" |
13 #include "src/api.h" | 13 #include "src/api.h" |
14 #include "src/handles-inl.h" | 14 #include "src/handles-inl.h" |
15 #include "src/isolate.h" | 15 #include "src/isolate.h" |
| 16 #include "src/objects-inl.h" |
16 #include "src/utils.h" | 17 #include "src/utils.h" |
17 | 18 |
18 #include "test/cctest/cctest.h" | 19 #include "test/cctest/cctest.h" |
19 | 20 |
20 using namespace v8::internal; | 21 using namespace v8::internal; |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 // Record the 'compiled' state of all top level functions. | 25 // Record the 'compiled' state of all top level functions. |
25 void GetTopLevelFunctionInfo( | 26 void GetTopLevelFunctionInfo( |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 LocalContext env; | 98 LocalContext env; |
98 | 99 |
99 const char src[] = "!function a(){}(),function b(){}(),function c(){}();"; | 100 const char src[] = "!function a(){}(),function b(){}(),function c(){}();"; |
100 std::unordered_map<std::string, bool> is_compiled; | 101 std::unordered_map<std::string, bool> is_compiled; |
101 GetTopLevelFunctionInfo(v8_compile(src), &is_compiled); | 102 GetTopLevelFunctionInfo(v8_compile(src), &is_compiled); |
102 | 103 |
103 DCHECK(is_compiled["a"]); | 104 DCHECK(is_compiled["a"]); |
104 DCHECK(is_compiled["b"]); | 105 DCHECK(is_compiled["b"]); |
105 DCHECK(is_compiled["c"]); | 106 DCHECK(is_compiled["c"]); |
106 } | 107 } |
OLD | NEW |