Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: test/cctest/interpreter/test-interpreter.cc

Issue 1419273008: [Interpreter] Add support for new.target (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_thisfunc
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/interpreter/test-bytecode-generator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2881 matching lines...) Expand 10 before | Expand all | Expand 10 after
2892 i::Factory* factory = isolate->factory(); 2892 i::Factory* factory = isolate->factory();
2893 2893
2894 InterpreterTester tester(handles.main_isolate(), 2894 InterpreterTester tester(handles.main_isolate(),
2895 "var f;\n f = function f() { return f.name; }"); 2895 "var f;\n f = function f() { return f.name; }");
2896 auto callable = tester.GetCallable<>(); 2896 auto callable = tester.GetCallable<>();
2897 2897
2898 Handle<i::Object> return_value = callable().ToHandleChecked(); 2898 Handle<i::Object> return_value = callable().ToHandleChecked();
2899 CHECK(return_value->SameValue(*factory->NewStringFromStaticChars("f"))); 2899 CHECK(return_value->SameValue(*factory->NewStringFromStaticChars("f")));
2900 } 2900 }
2901 2901
2902
2903 TEST(InterpreterNewTarget) {
2904 HandleAndZoneScope handles;
2905 i::Isolate* isolate = handles.main_isolate();
2906 i::Factory* factory = isolate->factory();
2907
2908 // TODO(rmcilroy): Add tests that we get the original constructor for
2909 // superclass constructors once we have class support.
2910 InterpreterTester tester(handles.main_isolate(),
2911 "function f() { this.a = new.target; }");
2912 auto callable = tester.GetCallable<>();
2913 callable().ToHandleChecked();
2914
2915 Handle<Object> new_target_name = v8::Utils::OpenHandle(
2916 *CompileRun("(function() { return (new f()).a.name; })();"));
2917 CHECK(new_target_name->SameValue(*factory->NewStringFromStaticChars("f")));
2918 }
2919
2902 } // namespace interpreter 2920 } // namespace interpreter
2903 } // namespace internal 2921 } // namespace internal
2904 } // namespace v8 2922 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/interpreter/test-bytecode-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698