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(rmcilroy): Remove this define after this flag is turned on globally | 5 // TODO(rmcilroy): 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 "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/execution.h" | 10 #include "src/execution.h" |
(...skipping 2867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2878 for (size_t i = 0; i < arraysize(switch_ops); i++) { | 2878 for (size_t i = 0; i < arraysize(switch_ops); i++) { |
2879 std::string source(InterpreterTester::SourceForBody(switch_ops[i].first)); | 2879 std::string source(InterpreterTester::SourceForBody(switch_ops[i].first)); |
2880 InterpreterTester tester(handles.main_isolate(), source.c_str()); | 2880 InterpreterTester tester(handles.main_isolate(), source.c_str()); |
2881 auto callable = tester.GetCallable<>(); | 2881 auto callable = tester.GetCallable<>(); |
2882 | 2882 |
2883 Handle<i::Object> return_value = callable().ToHandleChecked(); | 2883 Handle<i::Object> return_value = callable().ToHandleChecked(); |
2884 CHECK(return_value->SameValue(*switch_ops[i].second)); | 2884 CHECK(return_value->SameValue(*switch_ops[i].second)); |
2885 } | 2885 } |
2886 } | 2886 } |
2887 | 2887 |
| 2888 |
| 2889 TEST(InterpreterThisFunction) { |
| 2890 HandleAndZoneScope handles; |
| 2891 i::Isolate* isolate = handles.main_isolate(); |
| 2892 i::Factory* factory = isolate->factory(); |
| 2893 |
| 2894 InterpreterTester tester(handles.main_isolate(), |
| 2895 "var f;\n f = function f() { return f.name; }"); |
| 2896 auto callable = tester.GetCallable<>(); |
| 2897 |
| 2898 Handle<i::Object> return_value = callable().ToHandleChecked(); |
| 2899 CHECK(return_value->SameValue(*factory->NewStringFromStaticChars("f"))); |
| 2900 } |
| 2901 |
2888 } // namespace interpreter | 2902 } // namespace interpreter |
2889 } // namespace internal | 2903 } // namespace internal |
2890 } // namespace v8 | 2904 } // namespace v8 |
OLD | NEW |