| OLD | NEW |
| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
| 10 #include "src/compiler-dispatcher/optimizing-compile-dispatcher.h" | 10 #include "src/compiler-dispatcher/optimizing-compile-dispatcher.h" |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 } | 292 } |
| 293 | 293 |
| 294 | 294 |
| 295 RUNTIME_FUNCTION(Runtime_GetOptimizationCount) { | 295 RUNTIME_FUNCTION(Runtime_GetOptimizationCount) { |
| 296 HandleScope scope(isolate); | 296 HandleScope scope(isolate); |
| 297 DCHECK(args.length() == 1); | 297 DCHECK(args.length() == 1); |
| 298 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 298 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
| 299 return Smi::FromInt(function->shared()->opt_count()); | 299 return Smi::FromInt(function->shared()->opt_count()); |
| 300 } | 300 } |
| 301 | 301 |
| 302 static void ReturnThis(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 303 args.GetReturnValue().Set(args.This()); |
| 304 } |
| 302 | 305 |
| 303 RUNTIME_FUNCTION(Runtime_GetUndetectable) { | 306 RUNTIME_FUNCTION(Runtime_GetUndetectable) { |
| 304 HandleScope scope(isolate); | 307 HandleScope scope(isolate); |
| 305 DCHECK(args.length() == 0); | 308 DCHECK(args.length() == 0); |
| 306 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); | 309 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); |
| 307 | 310 |
| 308 Local<v8::ObjectTemplate> desc = v8::ObjectTemplate::New(v8_isolate); | 311 Local<v8::ObjectTemplate> desc = v8::ObjectTemplate::New(v8_isolate); |
| 309 desc->MarkAsUndetectable(); | 312 desc->MarkAsUndetectable(); |
| 313 desc->SetCallAsFunctionHandler(ReturnThis); |
| 310 Local<v8::Object> obj; | 314 Local<v8::Object> obj; |
| 311 if (!desc->NewInstance(v8_isolate->GetCurrentContext()).ToLocal(&obj)) { | 315 if (!desc->NewInstance(v8_isolate->GetCurrentContext()).ToLocal(&obj)) { |
| 312 return nullptr; | 316 return nullptr; |
| 313 } | 317 } |
| 314 return *Utils::OpenHandle(*obj); | 318 return *Utils::OpenHandle(*obj); |
| 315 } | 319 } |
| 316 | 320 |
| 317 static void call_as_function(const v8::FunctionCallbackInfo<v8::Value>& args) { | 321 static void call_as_function(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 318 double v1 = args[0] | 322 double v1 = args[0] |
| 319 ->NumberValue(v8::Isolate::GetCurrent()->GetCurrentContext()) | 323 ->NumberValue(v8::Isolate::GetCurrent()->GetCurrentContext()) |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 RUNTIME_FUNCTION(Runtime_ValidateWasmOrphanedInstance) { | 825 RUNTIME_FUNCTION(Runtime_ValidateWasmOrphanedInstance) { |
| 822 HandleScope shs(isolate); | 826 HandleScope shs(isolate); |
| 823 DCHECK(args.length() == 1); | 827 DCHECK(args.length() == 1); |
| 824 CONVERT_ARG_HANDLE_CHECKED_2(WasmInstanceObject, instance, 0); | 828 CONVERT_ARG_HANDLE_CHECKED_2(WasmInstanceObject, instance, 0); |
| 825 wasm::testing::ValidateOrphanedInstance(isolate, instance); | 829 wasm::testing::ValidateOrphanedInstance(isolate, instance); |
| 826 return isolate->heap()->ToBoolean(true); | 830 return isolate->heap()->ToBoolean(true); |
| 827 } | 831 } |
| 828 | 832 |
| 829 } // namespace internal | 833 } // namespace internal |
| 830 } // namespace v8 | 834 } // namespace v8 |
| OLD | NEW |