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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/execution.h" | 7 #include "src/execution.h" |
8 #include "src/handles.h" | 8 #include "src/handles.h" |
9 #include "src/interpreter/bytecode-array-builder.h" | 9 #include "src/interpreter/bytecode-array-builder.h" |
10 #include "src/interpreter/interpreter.h" | 10 #include "src/interpreter/interpreter.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 if (!feedback_vector_.is_null()) { | 148 if (!feedback_vector_.is_null()) { |
149 function->shared()->set_feedback_vector( | 149 function->shared()->set_feedback_vector( |
150 *feedback_vector_.ToHandleChecked()); | 150 *feedback_vector_.ToHandleChecked()); |
151 } | 151 } |
152 return function; | 152 return function; |
153 } | 153 } |
154 | 154 |
155 DISALLOW_COPY_AND_ASSIGN(InterpreterTester); | 155 DISALLOW_COPY_AND_ASSIGN(InterpreterTester); |
156 }; | 156 }; |
157 | 157 |
158 } // namespace interpreter | |
159 } // namespace internal | |
160 } // namespace v8 | |
161 | |
162 using v8::internal::BytecodeArray; | |
163 using v8::internal::Handle; | |
164 using v8::internal::LanguageMode; | |
165 using v8::internal::Object; | |
166 using v8::internal::Runtime; | |
167 using v8::internal::Smi; | |
168 using v8::internal::Strength; | |
169 using v8::internal::Token; | |
170 using namespace v8::internal::interpreter; | |
171 | 158 |
172 TEST(InterpreterReturn) { | 159 TEST(InterpreterReturn) { |
173 HandleAndZoneScope handles; | 160 HandleAndZoneScope handles; |
174 Handle<Object> undefined_value = | 161 Handle<Object> undefined_value = |
175 handles.main_isolate()->factory()->undefined_value(); | 162 handles.main_isolate()->factory()->undefined_value(); |
176 | 163 |
177 BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone()); | 164 BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone()); |
178 builder.set_locals_count(0); | 165 builder.set_locals_count(0); |
179 builder.set_context_count(0); | 166 builder.set_context_count(0); |
180 builder.set_parameter_count(1); | 167 builder.set_parameter_count(1); |
(...skipping 2536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2717 " }", | 2704 " }", |
2718 0}}; | 2705 0}}; |
2719 | 2706 |
2720 for (size_t i = 0; i < arraysize(for_in_samples); i++) { | 2707 for (size_t i = 0; i < arraysize(for_in_samples); i++) { |
2721 InterpreterTester tester(handles.main_isolate(), for_in_samples[i].first); | 2708 InterpreterTester tester(handles.main_isolate(), for_in_samples[i].first); |
2722 auto callable = tester.GetCallable<>(); | 2709 auto callable = tester.GetCallable<>(); |
2723 Handle<Object> return_val = callable().ToHandleChecked(); | 2710 Handle<Object> return_val = callable().ToHandleChecked(); |
2724 CHECK_EQ(Handle<Smi>::cast(return_val)->value(), for_in_samples[i].second); | 2711 CHECK_EQ(Handle<Smi>::cast(return_val)->value(), for_in_samples[i].second); |
2725 } | 2712 } |
2726 } | 2713 } |
| 2714 |
| 2715 } // namespace interpreter |
| 2716 } // namespace internal |
| 2717 } // namespace v8 |
OLD | NEW |