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

Side by Side Diff: src/runtime/runtime-internal.cc

Issue 2158303002: Begin porting CallSite to C++ (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@remove-overflow-boilerplate
Patch Set: Eager CallSite import and rebase Created 4 years, 5 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/runtime/runtime.h ('k') | src/v8.gyp » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/ast/prettyprinter.h" 8 #include "src/ast/prettyprinter.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 DCHECK(args.length() == 4); 387 DCHECK(args.length() == 4);
388 CONVERT_INT32_ARG_CHECKED(template_index, 0); 388 CONVERT_INT32_ARG_CHECKED(template_index, 0);
389 CONVERT_ARG_HANDLE_CHECKED(String, arg0, 1); 389 CONVERT_ARG_HANDLE_CHECKED(String, arg0, 1);
390 CONVERT_ARG_HANDLE_CHECKED(String, arg1, 2); 390 CONVERT_ARG_HANDLE_CHECKED(String, arg1, 2);
391 CONVERT_ARG_HANDLE_CHECKED(String, arg2, 3); 391 CONVERT_ARG_HANDLE_CHECKED(String, arg2, 3);
392 isolate->native_context()->IncrementErrorsThrown(); 392 isolate->native_context()->IncrementErrorsThrown();
393 RETURN_RESULT_OR_FAILURE(isolate, MessageTemplate::FormatMessage( 393 RETURN_RESULT_OR_FAILURE(isolate, MessageTemplate::FormatMessage(
394 template_index, arg0, arg1, arg2)); 394 template_index, arg0, arg1, arg2));
395 } 395 }
396 396
397 #define CALLSITE_GET(NAME, RETURN) \
398 RUNTIME_FUNCTION(Runtime_CallSite##NAME##RT) { \
399 HandleScope scope(isolate); \
400 DCHECK(args.length() == 1); \
401 CONVERT_ARG_HANDLE_CHECKED(JSObject, call_site_obj, 0); \
402 Handle<String> result; \
403 CallSite call_site(isolate, call_site_obj); \
404 CHECK(call_site.IsJavaScript() || call_site.IsWasm()); \
405 return RETURN(call_site.NAME(), isolate); \
406 }
407
408 static inline Object* ReturnDereferencedHandle(Handle<Object> obj,
409 Isolate* isolate) {
410 return *obj;
411 }
412
413
414 static inline Object* ReturnPositiveNumberOrNull(int value, Isolate* isolate) {
415 if (value >= 0) return *isolate->factory()->NewNumberFromInt(value);
416 return isolate->heap()->null_value();
417 }
418
419
420 static inline Object* ReturnBoolean(bool value, Isolate* isolate) {
421 return isolate->heap()->ToBoolean(value);
422 }
423
424
425 CALLSITE_GET(GetFileName, ReturnDereferencedHandle)
426 CALLSITE_GET(GetFunctionName, ReturnDereferencedHandle)
427 CALLSITE_GET(GetScriptNameOrSourceUrl, ReturnDereferencedHandle)
428 CALLSITE_GET(GetMethodName, ReturnDereferencedHandle)
429 CALLSITE_GET(GetLineNumber, ReturnPositiveNumberOrNull)
430 CALLSITE_GET(GetColumnNumber, ReturnPositiveNumberOrNull)
431 CALLSITE_GET(IsNative, ReturnBoolean)
432 CALLSITE_GET(IsToplevel, ReturnBoolean)
433 CALLSITE_GET(IsEval, ReturnBoolean)
434 CALLSITE_GET(IsConstructor, ReturnBoolean)
435
436 #undef CALLSITE_GET
437
438 397
439 RUNTIME_FUNCTION(Runtime_IS_VAR) { 398 RUNTIME_FUNCTION(Runtime_IS_VAR) {
440 UNREACHABLE(); // implemented as macro in the parser 399 UNREACHABLE(); // implemented as macro in the parser
441 return NULL; 400 return NULL;
442 } 401 }
443 402
444 403
445 namespace { 404 namespace {
446 405
447 bool ComputeLocation(Isolate* isolate, MessageLocation* target) { 406 bool ComputeLocation(Isolate* isolate, MessageLocation* target) {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 HandleScope scope(isolate); 578 HandleScope scope(isolate);
620 DCHECK_EQ(1, args.length()); 579 DCHECK_EQ(1, args.length());
621 CONVERT_ARG_CHECKED(Object, object, 0); 580 CONVERT_ARG_CHECKED(Object, object, 0);
622 bool is_wasm_object = 581 bool is_wasm_object =
623 object->IsJSObject() && wasm::IsWasmObject(JSObject::cast(object)); 582 object->IsJSObject() && wasm::IsWasmObject(JSObject::cast(object));
624 return *isolate->factory()->ToBoolean(is_wasm_object); 583 return *isolate->factory()->ToBoolean(is_wasm_object);
625 } 584 }
626 585
627 } // namespace internal 586 } // namespace internal
628 } // namespace v8 587 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | src/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698