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

Side by Side Diff: src/builtins/builtins-callsite.cc

Issue 2201823002: Make CallSite constructor inaccessible from JS (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@get-stack-trace-line
Patch Set: Revert "CHECK invalid arguments to CallSite constructor" Created 4 years, 4 months 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 | « src/builtins/builtins.h ('k') | src/builtins/builtins-internal.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "src/builtins/builtins.h" 5 #include "src/builtins/builtins.h"
6 #include "src/builtins/builtins-utils.h" 6 #include "src/builtins/builtins-utils.h"
7 7
8 #include "src/string-builder.h" 8 #include "src/string-builder.h"
9 #include "src/wasm/wasm-module.h" 9 #include "src/wasm/wasm-module.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 13
14 #define CHECK_CALLSITE(recv, method) \ 14 #define CHECK_CALLSITE(recv, method) \
15 CHECK_RECEIVER(JSObject, recv, method); \ 15 CHECK_RECEIVER(JSObject, recv, method); \
16 if (!JSReceiver::HasOwnProperty( \ 16 if (!JSReceiver::HasOwnProperty( \
17 recv, isolate->factory()->call_site_position_symbol()) \ 17 recv, isolate->factory()->call_site_position_symbol()) \
18 .FromMaybe(false)) { \ 18 .FromMaybe(false)) { \
19 THROW_NEW_ERROR_RETURN_FAILURE( \ 19 THROW_NEW_ERROR_RETURN_FAILURE( \
20 isolate, \ 20 isolate, \
21 NewTypeError(MessageTemplate::kCallSiteMethod, \ 21 NewTypeError(MessageTemplate::kCallSiteMethod, \
22 isolate->factory()->NewStringFromAsciiChecked(method))); \ 22 isolate->factory()->NewStringFromAsciiChecked(method))); \
23 } 23 }
24 24
25 BUILTIN(CallSiteConstructor) {
26 HandleScope scope(isolate);
27
28 Handle<JSFunction> target = args.target<JSFunction>();
29 Handle<Object> new_target = Handle<Object>::cast(args.new_target());
30 Handle<Object> receiver = args.atOrUndefined(isolate, 1);
31 Handle<Object> fun = args.atOrUndefined(isolate, 2);
32 Handle<Object> pos = args.atOrUndefined(isolate, 3);
33 Handle<Object> strict_mode = args.atOrUndefined(isolate, 4);
34
35 RETURN_RESULT_OR_FAILURE(
36 isolate, CallSiteUtils::Construct(isolate, target, new_target, receiver,
37 fun, pos, strict_mode));
38 }
39
40 namespace { 25 namespace {
41 26
42 Object* PositiveNumberOrNull(int value, Isolate* isolate) { 27 Object* PositiveNumberOrNull(int value, Isolate* isolate) {
43 if (value >= 0) return *isolate->factory()->NewNumberFromInt(value); 28 if (value >= 0) return *isolate->factory()->NewNumberFromInt(value);
44 return isolate->heap()->null_value(); 29 return isolate->heap()->null_value();
45 } 30 }
46 31
47 } // namespace 32 } // namespace
48 33
49 BUILTIN(CallSitePrototypeGetColumnNumber) { 34 BUILTIN(CallSitePrototypeGetColumnNumber) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 BUILTIN(CallSitePrototypeToString) { 194 BUILTIN(CallSitePrototypeToString) {
210 HandleScope scope(isolate); 195 HandleScope scope(isolate);
211 CHECK_CALLSITE(recv, "toString"); 196 CHECK_CALLSITE(recv, "toString");
212 RETURN_RESULT_OR_FAILURE(isolate, CallSiteUtils::ToString(isolate, recv)); 197 RETURN_RESULT_OR_FAILURE(isolate, CallSiteUtils::ToString(isolate, recv));
213 } 198 }
214 199
215 #undef CHECK_CALLSITE 200 #undef CHECK_CALLSITE
216 201
217 } // namespace internal 202 } // namespace internal
218 } // namespace v8 203 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins.h ('k') | src/builtins/builtins-internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698