| 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" |
| 11 #include "src/compiler.h" | 11 #include "src/compiler.h" |
| 12 #include "src/deoptimizer.h" | 12 #include "src/deoptimizer.h" |
| 13 #include "src/frames-inl.h" | 13 #include "src/frames-inl.h" |
| 14 #include "src/full-codegen/full-codegen.h" | 14 #include "src/full-codegen/full-codegen.h" |
| 15 #include "src/isolate-inl.h" | 15 #include "src/isolate-inl.h" |
| 16 #include "src/runtime-profiler.h" | 16 #include "src/runtime-profiler.h" |
| 17 #include "src/snapshot/code-serializer.h" | 17 #include "src/snapshot/code-serializer.h" |
| 18 #include "src/snapshot/natives.h" | 18 #include "src/snapshot/natives.h" |
| 19 #include "src/wasm/wasm-module.h" | 19 #include "src/wasm/wasm-module.h" |
| 20 #include "src/wasm/wasm-objects.h" | 20 #include "src/wasm/wasm-objects.h" |
| 21 | 21 |
| 22 namespace v8 { | 22 namespace v8 { |
| 23 namespace internal { | 23 namespace internal { |
| 24 | 24 |
| 25 RUNTIME_FUNCTION(Runtime_ConstructDouble) { | 25 RUNTIME_FUNCTION(Runtime_ConstructDouble) { |
| 26 HandleScope scope(isolate); | 26 HandleScope scope(isolate); |
| 27 DCHECK(args.length() == 2); | 27 DCHECK_EQ(2, args.length()); |
| 28 CONVERT_NUMBER_CHECKED(uint32_t, hi, Uint32, args[0]); | 28 CONVERT_NUMBER_CHECKED(uint32_t, hi, Uint32, args[0]); |
| 29 CONVERT_NUMBER_CHECKED(uint32_t, lo, Uint32, args[1]); | 29 CONVERT_NUMBER_CHECKED(uint32_t, lo, Uint32, args[1]); |
| 30 uint64_t result = (static_cast<uint64_t>(hi) << 32) | lo; | 30 uint64_t result = (static_cast<uint64_t>(hi) << 32) | lo; |
| 31 return *isolate->factory()->NewNumber(uint64_to_double(result)); | 31 return *isolate->factory()->NewNumber(uint64_to_double(result)); |
| 32 } | 32 } |
| 33 | 33 |
| 34 RUNTIME_FUNCTION(Runtime_DeoptimizeFunction) { | 34 RUNTIME_FUNCTION(Runtime_DeoptimizeFunction) { |
| 35 HandleScope scope(isolate); | 35 HandleScope scope(isolate); |
| 36 DCHECK(args.length() == 1); | 36 DCHECK_EQ(1, args.length()); |
| 37 | 37 |
| 38 // This function is used by fuzzers to get coverage in compiler. | 38 // This function is used by fuzzers to get coverage in compiler. |
| 39 // Ignore calls on non-function objects to avoid runtime errors. | 39 // Ignore calls on non-function objects to avoid runtime errors. |
| 40 CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0); | 40 CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0); |
| 41 if (!function_object->IsJSFunction()) { | 41 if (!function_object->IsJSFunction()) { |
| 42 return isolate->heap()->undefined_value(); | 42 return isolate->heap()->undefined_value(); |
| 43 } | 43 } |
| 44 Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); | 44 Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); |
| 45 | 45 |
| 46 // If the function is not optimized, just return. | 46 // If the function is not optimized, just return. |
| 47 if (!function->IsOptimized()) return isolate->heap()->undefined_value(); | 47 if (!function->IsOptimized()) return isolate->heap()->undefined_value(); |
| 48 | 48 |
| 49 // TODO(turbofan): Deoptimization is not supported yet. | 49 // TODO(turbofan): Deoptimization is not supported yet. |
| 50 if (function->code()->is_turbofanned() && | 50 if (function->code()->is_turbofanned() && |
| 51 function->shared()->asm_function()) { | 51 function->shared()->asm_function()) { |
| 52 return isolate->heap()->undefined_value(); | 52 return isolate->heap()->undefined_value(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 Deoptimizer::DeoptimizeFunction(*function); | 55 Deoptimizer::DeoptimizeFunction(*function); |
| 56 | 56 |
| 57 return isolate->heap()->undefined_value(); | 57 return isolate->heap()->undefined_value(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 | 60 |
| 61 RUNTIME_FUNCTION(Runtime_DeoptimizeNow) { | 61 RUNTIME_FUNCTION(Runtime_DeoptimizeNow) { |
| 62 HandleScope scope(isolate); | 62 HandleScope scope(isolate); |
| 63 DCHECK(args.length() == 0); | 63 DCHECK_EQ(0, args.length()); |
| 64 | 64 |
| 65 Handle<JSFunction> function; | 65 Handle<JSFunction> function; |
| 66 | 66 |
| 67 // Find the JavaScript function on the top of the stack. | 67 // Find the JavaScript function on the top of the stack. |
| 68 JavaScriptFrameIterator it(isolate); | 68 JavaScriptFrameIterator it(isolate); |
| 69 if (!it.done()) function = Handle<JSFunction>(it.frame()->function()); | 69 if (!it.done()) function = Handle<JSFunction>(it.frame()->function()); |
| 70 if (function.is_null()) return isolate->heap()->undefined_value(); | 70 if (function.is_null()) return isolate->heap()->undefined_value(); |
| 71 | 71 |
| 72 // If the function is not optimized, just return. | 72 // If the function is not optimized, just return. |
| 73 if (!function->IsOptimized()) return isolate->heap()->undefined_value(); | 73 if (!function->IsOptimized()) return isolate->heap()->undefined_value(); |
| 74 | 74 |
| 75 // TODO(turbofan): Deoptimization is not supported yet. | 75 // TODO(turbofan): Deoptimization is not supported yet. |
| 76 if (function->code()->is_turbofanned() && | 76 if (function->code()->is_turbofanned() && |
| 77 function->shared()->asm_function()) { | 77 function->shared()->asm_function()) { |
| 78 return isolate->heap()->undefined_value(); | 78 return isolate->heap()->undefined_value(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 Deoptimizer::DeoptimizeFunction(*function); | 81 Deoptimizer::DeoptimizeFunction(*function); |
| 82 | 82 |
| 83 return isolate->heap()->undefined_value(); | 83 return isolate->heap()->undefined_value(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 | 86 |
| 87 RUNTIME_FUNCTION(Runtime_RunningInSimulator) { | 87 RUNTIME_FUNCTION(Runtime_RunningInSimulator) { |
| 88 SealHandleScope shs(isolate); | 88 SealHandleScope shs(isolate); |
| 89 DCHECK(args.length() == 0); | 89 DCHECK_EQ(0, args.length()); |
| 90 #if defined(USE_SIMULATOR) | 90 #if defined(USE_SIMULATOR) |
| 91 return isolate->heap()->true_value(); | 91 return isolate->heap()->true_value(); |
| 92 #else | 92 #else |
| 93 return isolate->heap()->false_value(); | 93 return isolate->heap()->false_value(); |
| 94 #endif | 94 #endif |
| 95 } | 95 } |
| 96 | 96 |
| 97 | 97 |
| 98 RUNTIME_FUNCTION(Runtime_IsConcurrentRecompilationSupported) { | 98 RUNTIME_FUNCTION(Runtime_IsConcurrentRecompilationSupported) { |
| 99 SealHandleScope shs(isolate); | 99 SealHandleScope shs(isolate); |
| 100 DCHECK(args.length() == 0); | 100 DCHECK_EQ(0, args.length()); |
| 101 return isolate->heap()->ToBoolean( | 101 return isolate->heap()->ToBoolean( |
| 102 isolate->concurrent_recompilation_enabled()); | 102 isolate->concurrent_recompilation_enabled()); |
| 103 } | 103 } |
| 104 | 104 |
| 105 | 105 |
| 106 RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) { | 106 RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) { |
| 107 HandleScope scope(isolate); | 107 HandleScope scope(isolate); |
| 108 | 108 |
| 109 // This function is used by fuzzers, ignore calls with bogus arguments count. | 109 // This function is used by fuzzers, ignore calls with bogus arguments count. |
| 110 if (args.length() != 1 && args.length() != 2) { | 110 if (args.length() != 1 && args.length() != 2) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 isolate->concurrent_recompilation_enabled()) { | 145 isolate->concurrent_recompilation_enabled()) { |
| 146 function->AttemptConcurrentOptimization(); | 146 function->AttemptConcurrentOptimization(); |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 | 149 |
| 150 return isolate->heap()->undefined_value(); | 150 return isolate->heap()->undefined_value(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 RUNTIME_FUNCTION(Runtime_InterpretFunctionOnNextCall) { | 153 RUNTIME_FUNCTION(Runtime_InterpretFunctionOnNextCall) { |
| 154 HandleScope scope(isolate); | 154 HandleScope scope(isolate); |
| 155 DCHECK(args.length() == 1); | 155 DCHECK_EQ(1, args.length()); |
| 156 CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0); | 156 CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0); |
| 157 if (!function_object->IsJSFunction()) { | 157 if (!function_object->IsJSFunction()) { |
| 158 return isolate->heap()->undefined_value(); | 158 return isolate->heap()->undefined_value(); |
| 159 } | 159 } |
| 160 Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); | 160 Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); |
| 161 | 161 |
| 162 // Do not tier down if we are already on optimized code. Replacing optimized | 162 // Do not tier down if we are already on optimized code. Replacing optimized |
| 163 // code without actual deoptimization can lead to funny bugs. | 163 // code without actual deoptimization can lead to funny bugs. |
| 164 if (function->code()->kind() != Code::OPTIMIZED_FUNCTION && | 164 if (function->code()->kind() != Code::OPTIMIZED_FUNCTION && |
| 165 function->shared()->HasBytecodeArray()) { | 165 function->shared()->HasBytecodeArray()) { |
| 166 function->ReplaceCode(*isolate->builtins()->InterpreterEntryTrampoline()); | 166 function->ReplaceCode(*isolate->builtins()->InterpreterEntryTrampoline()); |
| 167 } | 167 } |
| 168 return isolate->heap()->undefined_value(); | 168 return isolate->heap()->undefined_value(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 RUNTIME_FUNCTION(Runtime_BaselineFunctionOnNextCall) { | 171 RUNTIME_FUNCTION(Runtime_BaselineFunctionOnNextCall) { |
| 172 HandleScope scope(isolate); | 172 HandleScope scope(isolate); |
| 173 DCHECK(args.length() == 1); | 173 DCHECK_EQ(1, args.length()); |
| 174 CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0); | 174 CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0); |
| 175 if (!function_object->IsJSFunction()) { | 175 if (!function_object->IsJSFunction()) { |
| 176 return isolate->heap()->undefined_value(); | 176 return isolate->heap()->undefined_value(); |
| 177 } | 177 } |
| 178 Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); | 178 Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); |
| 179 | 179 |
| 180 // If function isn't compiled, compile it now. | 180 // If function isn't compiled, compile it now. |
| 181 if (!function->shared()->is_compiled() && | 181 if (!function->shared()->is_compiled() && |
| 182 !Compiler::Compile(function, Compiler::CLEAR_EXCEPTION)) { | 182 !Compiler::Compile(function, Compiler::CLEAR_EXCEPTION)) { |
| 183 return isolate->heap()->undefined_value(); | 183 return isolate->heap()->undefined_value(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 isolate->runtime_profiler()->AttemptOnStackReplacement( | 221 isolate->runtime_profiler()->AttemptOnStackReplacement( |
| 222 it.frame(), AbstractCode::kMaxLoopNestingMarker); | 222 it.frame(), AbstractCode::kMaxLoopNestingMarker); |
| 223 } | 223 } |
| 224 | 224 |
| 225 return isolate->heap()->undefined_value(); | 225 return isolate->heap()->undefined_value(); |
| 226 } | 226 } |
| 227 | 227 |
| 228 | 228 |
| 229 RUNTIME_FUNCTION(Runtime_NeverOptimizeFunction) { | 229 RUNTIME_FUNCTION(Runtime_NeverOptimizeFunction) { |
| 230 HandleScope scope(isolate); | 230 HandleScope scope(isolate); |
| 231 DCHECK(args.length() == 1); | 231 DCHECK_EQ(1, args.length()); |
| 232 CONVERT_ARG_CHECKED(JSFunction, function, 0); | 232 CONVERT_ARG_CHECKED(JSFunction, function, 0); |
| 233 function->shared()->set_disable_optimization_reason( | 233 function->shared()->set_disable_optimization_reason( |
| 234 kOptimizationDisabledForTest); | 234 kOptimizationDisabledForTest); |
| 235 function->shared()->set_optimization_disabled(true); | 235 function->shared()->set_optimization_disabled(true); |
| 236 return isolate->heap()->undefined_value(); | 236 return isolate->heap()->undefined_value(); |
| 237 } | 237 } |
| 238 | 238 |
| 239 | 239 |
| 240 RUNTIME_FUNCTION(Runtime_GetOptimizationStatus) { | 240 RUNTIME_FUNCTION(Runtime_GetOptimizationStatus) { |
| 241 HandleScope scope(isolate); | 241 HandleScope scope(isolate); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 } | 282 } |
| 283 if (function->IsInterpreted()) { | 283 if (function->IsInterpreted()) { |
| 284 return Smi::FromInt(8); // 8 == "Interpreted". | 284 return Smi::FromInt(8); // 8 == "Interpreted". |
| 285 } | 285 } |
| 286 return function->IsOptimized() ? Smi::FromInt(1) // 1 == "yes". | 286 return function->IsOptimized() ? Smi::FromInt(1) // 1 == "yes". |
| 287 : Smi::FromInt(2); // 2 == "no". | 287 : Smi::FromInt(2); // 2 == "no". |
| 288 } | 288 } |
| 289 | 289 |
| 290 | 290 |
| 291 RUNTIME_FUNCTION(Runtime_UnblockConcurrentRecompilation) { | 291 RUNTIME_FUNCTION(Runtime_UnblockConcurrentRecompilation) { |
| 292 DCHECK(args.length() == 0); | 292 DCHECK_EQ(0, args.length()); |
| 293 if (FLAG_block_concurrent_recompilation && | 293 if (FLAG_block_concurrent_recompilation && |
| 294 isolate->concurrent_recompilation_enabled()) { | 294 isolate->concurrent_recompilation_enabled()) { |
| 295 isolate->optimizing_compile_dispatcher()->Unblock(); | 295 isolate->optimizing_compile_dispatcher()->Unblock(); |
| 296 } | 296 } |
| 297 return isolate->heap()->undefined_value(); | 297 return isolate->heap()->undefined_value(); |
| 298 } | 298 } |
| 299 | 299 |
| 300 | 300 |
| 301 RUNTIME_FUNCTION(Runtime_GetOptimizationCount) { | 301 RUNTIME_FUNCTION(Runtime_GetOptimizationCount) { |
| 302 HandleScope scope(isolate); | 302 HandleScope scope(isolate); |
| 303 DCHECK(args.length() == 1); | 303 DCHECK_EQ(1, args.length()); |
| 304 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 304 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
| 305 return Smi::FromInt(function->shared()->opt_count()); | 305 return Smi::FromInt(function->shared()->opt_count()); |
| 306 } | 306 } |
| 307 | 307 |
| 308 static void ReturnThis(const v8::FunctionCallbackInfo<v8::Value>& args) { | 308 static void ReturnThis(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 309 args.GetReturnValue().Set(args.This()); | 309 args.GetReturnValue().Set(args.This()); |
| 310 } | 310 } |
| 311 | 311 |
| 312 RUNTIME_FUNCTION(Runtime_GetUndetectable) { | 312 RUNTIME_FUNCTION(Runtime_GetUndetectable) { |
| 313 HandleScope scope(isolate); | 313 HandleScope scope(isolate); |
| 314 DCHECK(args.length() == 0); | 314 DCHECK_EQ(0, args.length()); |
| 315 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); | 315 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); |
| 316 | 316 |
| 317 Local<v8::ObjectTemplate> desc = v8::ObjectTemplate::New(v8_isolate); | 317 Local<v8::ObjectTemplate> desc = v8::ObjectTemplate::New(v8_isolate); |
| 318 desc->MarkAsUndetectable(); | 318 desc->MarkAsUndetectable(); |
| 319 desc->SetCallAsFunctionHandler(ReturnThis); | 319 desc->SetCallAsFunctionHandler(ReturnThis); |
| 320 Local<v8::Object> obj; | 320 Local<v8::Object> obj; |
| 321 if (!desc->NewInstance(v8_isolate->GetCurrentContext()).ToLocal(&obj)) { | 321 if (!desc->NewInstance(v8_isolate->GetCurrentContext()).ToLocal(&obj)) { |
| 322 return nullptr; | 322 return nullptr; |
| 323 } | 323 } |
| 324 return *Utils::OpenHandle(*obj); | 324 return *Utils::OpenHandle(*obj); |
| 325 } | 325 } |
| 326 | 326 |
| 327 static void call_as_function(const v8::FunctionCallbackInfo<v8::Value>& args) { | 327 static void call_as_function(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 328 double v1 = args[0] | 328 double v1 = args[0] |
| 329 ->NumberValue(v8::Isolate::GetCurrent()->GetCurrentContext()) | 329 ->NumberValue(v8::Isolate::GetCurrent()->GetCurrentContext()) |
| 330 .ToChecked(); | 330 .ToChecked(); |
| 331 double v2 = args[1] | 331 double v2 = args[1] |
| 332 ->NumberValue(v8::Isolate::GetCurrent()->GetCurrentContext()) | 332 ->NumberValue(v8::Isolate::GetCurrent()->GetCurrentContext()) |
| 333 .ToChecked(); | 333 .ToChecked(); |
| 334 args.GetReturnValue().Set( | 334 args.GetReturnValue().Set( |
| 335 v8::Number::New(v8::Isolate::GetCurrent(), v1 - v2)); | 335 v8::Number::New(v8::Isolate::GetCurrent(), v1 - v2)); |
| 336 } | 336 } |
| 337 | 337 |
| 338 // Returns a callable object. The object returns the difference of its two | 338 // Returns a callable object. The object returns the difference of its two |
| 339 // parameters when it is called. | 339 // parameters when it is called. |
| 340 RUNTIME_FUNCTION(Runtime_GetCallable) { | 340 RUNTIME_FUNCTION(Runtime_GetCallable) { |
| 341 HandleScope scope(isolate); | 341 HandleScope scope(isolate); |
| 342 DCHECK(args.length() == 0); | 342 DCHECK_EQ(0, args.length()); |
| 343 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); | 343 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); |
| 344 Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(v8_isolate); | 344 Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(v8_isolate); |
| 345 Local<ObjectTemplate> instance_template = t->InstanceTemplate(); | 345 Local<ObjectTemplate> instance_template = t->InstanceTemplate(); |
| 346 instance_template->SetCallAsFunctionHandler(call_as_function); | 346 instance_template->SetCallAsFunctionHandler(call_as_function); |
| 347 v8_isolate->GetCurrentContext(); | 347 v8_isolate->GetCurrentContext(); |
| 348 Local<v8::Object> instance = | 348 Local<v8::Object> instance = |
| 349 t->GetFunction(v8_isolate->GetCurrentContext()) | 349 t->GetFunction(v8_isolate->GetCurrentContext()) |
| 350 .ToLocalChecked() | 350 .ToLocalChecked() |
| 351 ->NewInstance(v8_isolate->GetCurrentContext()) | 351 ->NewInstance(v8_isolate->GetCurrentContext()) |
| 352 .ToLocalChecked(); | 352 .ToLocalChecked(); |
| 353 return *Utils::OpenHandle(*instance); | 353 return *Utils::OpenHandle(*instance); |
| 354 } | 354 } |
| 355 | 355 |
| 356 RUNTIME_FUNCTION(Runtime_ClearFunctionTypeFeedback) { | 356 RUNTIME_FUNCTION(Runtime_ClearFunctionTypeFeedback) { |
| 357 HandleScope scope(isolate); | 357 HandleScope scope(isolate); |
| 358 DCHECK(args.length() == 1); | 358 DCHECK_EQ(1, args.length()); |
| 359 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 359 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
| 360 function->ClearTypeFeedbackInfo(); | 360 function->ClearTypeFeedbackInfo(); |
| 361 Code* unoptimized = function->shared()->code(); | 361 Code* unoptimized = function->shared()->code(); |
| 362 if (unoptimized->kind() == Code::FUNCTION) { | 362 if (unoptimized->kind() == Code::FUNCTION) { |
| 363 unoptimized->ClearInlineCaches(); | 363 unoptimized->ClearInlineCaches(); |
| 364 } | 364 } |
| 365 return isolate->heap()->undefined_value(); | 365 return isolate->heap()->undefined_value(); |
| 366 } | 366 } |
| 367 | 367 |
| 368 RUNTIME_FUNCTION(Runtime_CheckWasmWrapperElision) { | 368 RUNTIME_FUNCTION(Runtime_CheckWasmWrapperElision) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 ++count; | 423 ++count; |
| 424 imported_fct = handle(target); | 424 imported_fct = handle(target); |
| 425 } | 425 } |
| 426 } | 426 } |
| 427 CHECK_LE(count, 1); | 427 CHECK_LE(count, 1); |
| 428 return isolate->heap()->ToBoolean(count == 1); | 428 return isolate->heap()->ToBoolean(count == 1); |
| 429 } | 429 } |
| 430 | 430 |
| 431 RUNTIME_FUNCTION(Runtime_NotifyContextDisposed) { | 431 RUNTIME_FUNCTION(Runtime_NotifyContextDisposed) { |
| 432 HandleScope scope(isolate); | 432 HandleScope scope(isolate); |
| 433 DCHECK(args.length() == 0); | 433 DCHECK_EQ(0, args.length()); |
| 434 isolate->heap()->NotifyContextDisposed(true); | 434 isolate->heap()->NotifyContextDisposed(true); |
| 435 return isolate->heap()->undefined_value(); | 435 return isolate->heap()->undefined_value(); |
| 436 } | 436 } |
| 437 | 437 |
| 438 | 438 |
| 439 RUNTIME_FUNCTION(Runtime_SetAllocationTimeout) { | 439 RUNTIME_FUNCTION(Runtime_SetAllocationTimeout) { |
| 440 SealHandleScope shs(isolate); | 440 SealHandleScope shs(isolate); |
| 441 DCHECK(args.length() == 2 || args.length() == 3); | 441 DCHECK(args.length() == 2 || args.length() == 3); |
| 442 #ifdef DEBUG | 442 #ifdef DEBUG |
| 443 CONVERT_INT32_ARG_CHECKED(interval, 0); | 443 CONVERT_INT32_ARG_CHECKED(interval, 0); |
| 444 CONVERT_INT32_ARG_CHECKED(timeout, 1); | 444 CONVERT_INT32_ARG_CHECKED(timeout, 1); |
| 445 isolate->heap()->set_allocation_timeout(timeout); | 445 isolate->heap()->set_allocation_timeout(timeout); |
| 446 FLAG_gc_interval = interval; | 446 FLAG_gc_interval = interval; |
| 447 if (args.length() == 3) { | 447 if (args.length() == 3) { |
| 448 // Enable/disable inline allocation if requested. | 448 // Enable/disable inline allocation if requested. |
| 449 CONVERT_BOOLEAN_ARG_CHECKED(inline_allocation, 2); | 449 CONVERT_BOOLEAN_ARG_CHECKED(inline_allocation, 2); |
| 450 if (inline_allocation) { | 450 if (inline_allocation) { |
| 451 isolate->heap()->EnableInlineAllocation(); | 451 isolate->heap()->EnableInlineAllocation(); |
| 452 } else { | 452 } else { |
| 453 isolate->heap()->DisableInlineAllocation(); | 453 isolate->heap()->DisableInlineAllocation(); |
| 454 } | 454 } |
| 455 } | 455 } |
| 456 #endif | 456 #endif |
| 457 return isolate->heap()->undefined_value(); | 457 return isolate->heap()->undefined_value(); |
| 458 } | 458 } |
| 459 | 459 |
| 460 | 460 |
| 461 RUNTIME_FUNCTION(Runtime_DebugPrint) { | 461 RUNTIME_FUNCTION(Runtime_DebugPrint) { |
| 462 SealHandleScope shs(isolate); | 462 SealHandleScope shs(isolate); |
| 463 DCHECK(args.length() == 1); | 463 DCHECK_EQ(1, args.length()); |
| 464 | 464 |
| 465 OFStream os(stdout); | 465 OFStream os(stdout); |
| 466 #ifdef DEBUG | 466 #ifdef DEBUG |
| 467 if (args[0]->IsString() && isolate->context() != nullptr) { | 467 if (args[0]->IsString() && isolate->context() != nullptr) { |
| 468 // If we have a string, assume it's a code "marker" | 468 // If we have a string, assume it's a code "marker" |
| 469 // and print some interesting cpu debugging info. | 469 // and print some interesting cpu debugging info. |
| 470 JavaScriptFrameIterator it(isolate); | 470 JavaScriptFrameIterator it(isolate); |
| 471 JavaScriptFrame* frame = it.frame(); | 471 JavaScriptFrame* frame = it.frame(); |
| 472 os << "fp = " << static_cast<void*>(frame->fp()) | 472 os << "fp = " << static_cast<void*>(frame->fp()) |
| 473 << ", sp = " << static_cast<void*>(frame->sp()) | 473 << ", sp = " << static_cast<void*>(frame->sp()) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 484 os << Brief(args[0]); | 484 os << Brief(args[0]); |
| 485 #endif | 485 #endif |
| 486 os << std::endl; | 486 os << std::endl; |
| 487 | 487 |
| 488 return args[0]; // return TOS | 488 return args[0]; // return TOS |
| 489 } | 489 } |
| 490 | 490 |
| 491 | 491 |
| 492 RUNTIME_FUNCTION(Runtime_DebugTrace) { | 492 RUNTIME_FUNCTION(Runtime_DebugTrace) { |
| 493 SealHandleScope shs(isolate); | 493 SealHandleScope shs(isolate); |
| 494 DCHECK(args.length() == 0); | 494 DCHECK_EQ(0, args.length()); |
| 495 isolate->PrintStack(stdout); | 495 isolate->PrintStack(stdout); |
| 496 return isolate->heap()->undefined_value(); | 496 return isolate->heap()->undefined_value(); |
| 497 } | 497 } |
| 498 | 498 |
| 499 | 499 |
| 500 // This will not allocate (flatten the string), but it may run | 500 // This will not allocate (flatten the string), but it may run |
| 501 // very slowly for very deeply nested ConsStrings. For debugging use only. | 501 // very slowly for very deeply nested ConsStrings. For debugging use only. |
| 502 RUNTIME_FUNCTION(Runtime_GlobalPrint) { | 502 RUNTIME_FUNCTION(Runtime_GlobalPrint) { |
| 503 SealHandleScope shs(isolate); | 503 SealHandleScope shs(isolate); |
| 504 DCHECK(args.length() == 1); | 504 DCHECK_EQ(1, args.length()); |
| 505 | 505 |
| 506 CONVERT_ARG_CHECKED(String, string, 0); | 506 CONVERT_ARG_CHECKED(String, string, 0); |
| 507 StringCharacterStream stream(string); | 507 StringCharacterStream stream(string); |
| 508 while (stream.HasMore()) { | 508 while (stream.HasMore()) { |
| 509 uint16_t character = stream.GetNext(); | 509 uint16_t character = stream.GetNext(); |
| 510 PrintF("%c", character); | 510 PrintF("%c", character); |
| 511 } | 511 } |
| 512 return string; | 512 return string; |
| 513 } | 513 } |
| 514 | 514 |
| 515 | 515 |
| 516 RUNTIME_FUNCTION(Runtime_SystemBreak) { | 516 RUNTIME_FUNCTION(Runtime_SystemBreak) { |
| 517 // The code below doesn't create handles, but when breaking here in GDB | 517 // The code below doesn't create handles, but when breaking here in GDB |
| 518 // having a handle scope might be useful. | 518 // having a handle scope might be useful. |
| 519 HandleScope scope(isolate); | 519 HandleScope scope(isolate); |
| 520 DCHECK(args.length() == 0); | 520 DCHECK_EQ(0, args.length()); |
| 521 base::OS::DebugBreak(); | 521 base::OS::DebugBreak(); |
| 522 return isolate->heap()->undefined_value(); | 522 return isolate->heap()->undefined_value(); |
| 523 } | 523 } |
| 524 | 524 |
| 525 | 525 |
| 526 // Sets a v8 flag. | 526 // Sets a v8 flag. |
| 527 RUNTIME_FUNCTION(Runtime_SetFlags) { | 527 RUNTIME_FUNCTION(Runtime_SetFlags) { |
| 528 SealHandleScope shs(isolate); | 528 SealHandleScope shs(isolate); |
| 529 DCHECK(args.length() == 1); | 529 DCHECK_EQ(1, args.length()); |
| 530 CONVERT_ARG_CHECKED(String, arg, 0); | 530 CONVERT_ARG_CHECKED(String, arg, 0); |
| 531 std::unique_ptr<char[]> flags = | 531 std::unique_ptr<char[]> flags = |
| 532 arg->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 532 arg->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 533 FlagList::SetFlagsFromString(flags.get(), StrLength(flags.get())); | 533 FlagList::SetFlagsFromString(flags.get(), StrLength(flags.get())); |
| 534 return isolate->heap()->undefined_value(); | 534 return isolate->heap()->undefined_value(); |
| 535 } | 535 } |
| 536 | 536 |
| 537 | 537 |
| 538 RUNTIME_FUNCTION(Runtime_Abort) { | 538 RUNTIME_FUNCTION(Runtime_Abort) { |
| 539 SealHandleScope shs(isolate); | 539 SealHandleScope shs(isolate); |
| 540 DCHECK(args.length() == 1); | 540 DCHECK_EQ(1, args.length()); |
| 541 CONVERT_SMI_ARG_CHECKED(message_id, 0); | 541 CONVERT_SMI_ARG_CHECKED(message_id, 0); |
| 542 const char* message = | 542 const char* message = |
| 543 GetBailoutReason(static_cast<BailoutReason>(message_id)); | 543 GetBailoutReason(static_cast<BailoutReason>(message_id)); |
| 544 base::OS::PrintError("abort: %s\n", message); | 544 base::OS::PrintError("abort: %s\n", message); |
| 545 isolate->PrintStack(stderr); | 545 isolate->PrintStack(stderr); |
| 546 base::OS::Abort(); | 546 base::OS::Abort(); |
| 547 UNREACHABLE(); | 547 UNREACHABLE(); |
| 548 return NULL; | 548 return NULL; |
| 549 } | 549 } |
| 550 | 550 |
| 551 | 551 |
| 552 RUNTIME_FUNCTION(Runtime_AbortJS) { | 552 RUNTIME_FUNCTION(Runtime_AbortJS) { |
| 553 HandleScope scope(isolate); | 553 HandleScope scope(isolate); |
| 554 DCHECK(args.length() == 1); | 554 DCHECK_EQ(1, args.length()); |
| 555 CONVERT_ARG_HANDLE_CHECKED(String, message, 0); | 555 CONVERT_ARG_HANDLE_CHECKED(String, message, 0); |
| 556 base::OS::PrintError("abort: %s\n", message->ToCString().get()); | 556 base::OS::PrintError("abort: %s\n", message->ToCString().get()); |
| 557 isolate->PrintStack(stderr); | 557 isolate->PrintStack(stderr); |
| 558 base::OS::Abort(); | 558 base::OS::Abort(); |
| 559 UNREACHABLE(); | 559 UNREACHABLE(); |
| 560 return NULL; | 560 return NULL; |
| 561 } | 561 } |
| 562 | 562 |
| 563 | 563 |
| 564 RUNTIME_FUNCTION(Runtime_NativeScriptsCount) { | 564 RUNTIME_FUNCTION(Runtime_NativeScriptsCount) { |
| 565 DCHECK(args.length() == 0); | 565 DCHECK_EQ(0, args.length()); |
| 566 return Smi::FromInt(Natives::GetBuiltinsCount()); | 566 return Smi::FromInt(Natives::GetBuiltinsCount()); |
| 567 } | 567 } |
| 568 | 568 |
| 569 // TODO(5510): remove this. | 569 // TODO(5510): remove this. |
| 570 RUNTIME_FUNCTION(Runtime_GetV8Version) { | 570 RUNTIME_FUNCTION(Runtime_GetV8Version) { |
| 571 HandleScope scope(isolate); | 571 HandleScope scope(isolate); |
| 572 DCHECK(args.length() == 0); | 572 DCHECK_EQ(0, args.length()); |
| 573 | 573 |
| 574 const char* version_string = v8::V8::GetVersion(); | 574 const char* version_string = v8::V8::GetVersion(); |
| 575 | 575 |
| 576 return *isolate->factory()->NewStringFromAsciiChecked(version_string); | 576 return *isolate->factory()->NewStringFromAsciiChecked(version_string); |
| 577 } | 577 } |
| 578 | 578 |
| 579 | 579 |
| 580 RUNTIME_FUNCTION(Runtime_DisassembleFunction) { | 580 RUNTIME_FUNCTION(Runtime_DisassembleFunction) { |
| 581 HandleScope scope(isolate); | 581 HandleScope scope(isolate); |
| 582 #ifdef DEBUG | 582 #ifdef DEBUG |
| 583 DCHECK(args.length() == 1); | 583 DCHECK_EQ(1, args.length()); |
| 584 // Get the function and make sure it is compiled. | 584 // Get the function and make sure it is compiled. |
| 585 CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0); | 585 CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0); |
| 586 if (!Compiler::Compile(func, Compiler::KEEP_EXCEPTION)) { | 586 if (!Compiler::Compile(func, Compiler::KEEP_EXCEPTION)) { |
| 587 return isolate->heap()->exception(); | 587 return isolate->heap()->exception(); |
| 588 } | 588 } |
| 589 OFStream os(stdout); | 589 OFStream os(stdout); |
| 590 func->code()->Print(os); | 590 func->code()->Print(os); |
| 591 os << std::endl; | 591 os << std::endl; |
| 592 #endif // DEBUG | 592 #endif // DEBUG |
| 593 return isolate->heap()->undefined_value(); | 593 return isolate->heap()->undefined_value(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 RUNTIME_FUNCTION(Runtime_TraceTailCall) { | 637 RUNTIME_FUNCTION(Runtime_TraceTailCall) { |
| 638 SealHandleScope shs(isolate); | 638 SealHandleScope shs(isolate); |
| 639 DCHECK_EQ(0, args.length()); | 639 DCHECK_EQ(0, args.length()); |
| 640 PrintIndentation(isolate); | 640 PrintIndentation(isolate); |
| 641 PrintF("} -> tail call ->\n"); | 641 PrintF("} -> tail call ->\n"); |
| 642 return isolate->heap()->undefined_value(); | 642 return isolate->heap()->undefined_value(); |
| 643 } | 643 } |
| 644 | 644 |
| 645 RUNTIME_FUNCTION(Runtime_GetExceptionDetails) { | 645 RUNTIME_FUNCTION(Runtime_GetExceptionDetails) { |
| 646 HandleScope shs(isolate); | 646 HandleScope shs(isolate); |
| 647 DCHECK(args.length() == 1); | 647 DCHECK_EQ(1, args.length()); |
| 648 CONVERT_ARG_HANDLE_CHECKED(JSObject, exception_obj, 0); | 648 CONVERT_ARG_HANDLE_CHECKED(JSObject, exception_obj, 0); |
| 649 | 649 |
| 650 Factory* factory = isolate->factory(); | 650 Factory* factory = isolate->factory(); |
| 651 Handle<JSMessageObject> message_obj = | 651 Handle<JSMessageObject> message_obj = |
| 652 isolate->CreateMessage(exception_obj, nullptr); | 652 isolate->CreateMessage(exception_obj, nullptr); |
| 653 | 653 |
| 654 Handle<JSObject> message = factory->NewJSObject(isolate->object_function()); | 654 Handle<JSObject> message = factory->NewJSObject(isolate->object_function()); |
| 655 | 655 |
| 656 Handle<String> key; | 656 Handle<String> key; |
| 657 Handle<Object> value; | 657 Handle<Object> value; |
| 658 | 658 |
| 659 key = factory->NewStringFromAsciiChecked("start_pos"); | 659 key = factory->NewStringFromAsciiChecked("start_pos"); |
| 660 value = handle(Smi::FromInt(message_obj->start_position()), isolate); | 660 value = handle(Smi::FromInt(message_obj->start_position()), isolate); |
| 661 JSObject::SetProperty(message, key, value, STRICT).Assert(); | 661 JSObject::SetProperty(message, key, value, STRICT).Assert(); |
| 662 | 662 |
| 663 key = factory->NewStringFromAsciiChecked("end_pos"); | 663 key = factory->NewStringFromAsciiChecked("end_pos"); |
| 664 value = handle(Smi::FromInt(message_obj->end_position()), isolate); | 664 value = handle(Smi::FromInt(message_obj->end_position()), isolate); |
| 665 JSObject::SetProperty(message, key, value, STRICT).Assert(); | 665 JSObject::SetProperty(message, key, value, STRICT).Assert(); |
| 666 | 666 |
| 667 return *message; | 667 return *message; |
| 668 } | 668 } |
| 669 | 669 |
| 670 RUNTIME_FUNCTION(Runtime_HaveSameMap) { | 670 RUNTIME_FUNCTION(Runtime_HaveSameMap) { |
| 671 SealHandleScope shs(isolate); | 671 SealHandleScope shs(isolate); |
| 672 DCHECK(args.length() == 2); | 672 DCHECK_EQ(2, args.length()); |
| 673 CONVERT_ARG_CHECKED(JSObject, obj1, 0); | 673 CONVERT_ARG_CHECKED(JSObject, obj1, 0); |
| 674 CONVERT_ARG_CHECKED(JSObject, obj2, 1); | 674 CONVERT_ARG_CHECKED(JSObject, obj2, 1); |
| 675 return isolate->heap()->ToBoolean(obj1->map() == obj2->map()); | 675 return isolate->heap()->ToBoolean(obj1->map() == obj2->map()); |
| 676 } | 676 } |
| 677 | 677 |
| 678 | 678 |
| 679 RUNTIME_FUNCTION(Runtime_InNewSpace) { | 679 RUNTIME_FUNCTION(Runtime_InNewSpace) { |
| 680 SealHandleScope shs(isolate); | 680 SealHandleScope shs(isolate); |
| 681 DCHECK(args.length() == 1); | 681 DCHECK_EQ(1, args.length()); |
| 682 CONVERT_ARG_CHECKED(Object, obj, 0); | 682 CONVERT_ARG_CHECKED(Object, obj, 0); |
| 683 return isolate->heap()->ToBoolean(isolate->heap()->InNewSpace(obj)); | 683 return isolate->heap()->ToBoolean(isolate->heap()->InNewSpace(obj)); |
| 684 } | 684 } |
| 685 | 685 |
| 686 RUNTIME_FUNCTION(Runtime_IsAsmWasmCode) { | 686 RUNTIME_FUNCTION(Runtime_IsAsmWasmCode) { |
| 687 SealHandleScope shs(isolate); | 687 SealHandleScope shs(isolate); |
| 688 DCHECK_EQ(1, args.length()); | 688 DCHECK_EQ(1, args.length()); |
| 689 CONVERT_ARG_CHECKED(JSFunction, function, 0); | 689 CONVERT_ARG_CHECKED(JSFunction, function, 0); |
| 690 if (!function->shared()->HasAsmWasmData()) { | 690 if (!function->shared()->HasAsmWasmData()) { |
| 691 // Doesn't have wasm data. | 691 // Doesn't have wasm data. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 } | 738 } |
| 739 | 739 |
| 740 #define CONVERT_ARG_HANDLE_CHECKED_2(Type, name, index) \ | 740 #define CONVERT_ARG_HANDLE_CHECKED_2(Type, name, index) \ |
| 741 CHECK(Type::Is##Type(args[index])); \ | 741 CHECK(Type::Is##Type(args[index])); \ |
| 742 Handle<Type> name = args.at<Type>(index); | 742 Handle<Type> name = args.at<Type>(index); |
| 743 | 743 |
| 744 // Take a compiled wasm module, serialize it and copy the buffer into an array | 744 // Take a compiled wasm module, serialize it and copy the buffer into an array |
| 745 // buffer, which is then returned. | 745 // buffer, which is then returned. |
| 746 RUNTIME_FUNCTION(Runtime_SerializeWasmModule) { | 746 RUNTIME_FUNCTION(Runtime_SerializeWasmModule) { |
| 747 HandleScope shs(isolate); | 747 HandleScope shs(isolate); |
| 748 DCHECK(args.length() == 1); | 748 DCHECK_EQ(1, args.length()); |
| 749 CONVERT_ARG_HANDLE_CHECKED_2(WasmModuleObject, module_obj, 0); | 749 CONVERT_ARG_HANDLE_CHECKED_2(WasmModuleObject, module_obj, 0); |
| 750 | 750 |
| 751 Handle<WasmCompiledModule> orig(module_obj->compiled_module()); | 751 Handle<WasmCompiledModule> orig(module_obj->compiled_module()); |
| 752 std::unique_ptr<ScriptData> data = | 752 std::unique_ptr<ScriptData> data = |
| 753 WasmCompiledModuleSerializer::SerializeWasmModule(isolate, orig); | 753 WasmCompiledModuleSerializer::SerializeWasmModule(isolate, orig); |
| 754 void* buff = isolate->array_buffer_allocator()->Allocate(data->length()); | 754 void* buff = isolate->array_buffer_allocator()->Allocate(data->length()); |
| 755 Handle<JSArrayBuffer> ret = isolate->factory()->NewJSArrayBuffer(); | 755 Handle<JSArrayBuffer> ret = isolate->factory()->NewJSArrayBuffer(); |
| 756 JSArrayBuffer::Setup(ret, isolate, false, buff, data->length()); | 756 JSArrayBuffer::Setup(ret, isolate, false, buff, data->length()); |
| 757 memcpy(buff, data->data(), data->length()); | 757 memcpy(buff, data->data(), data->length()); |
| 758 return *ret; | 758 return *ret; |
| 759 } | 759 } |
| 760 | 760 |
| 761 // Take an array buffer and attempt to reconstruct a compiled wasm module. | 761 // Take an array buffer and attempt to reconstruct a compiled wasm module. |
| 762 // Return undefined if unsuccessful. | 762 // Return undefined if unsuccessful. |
| 763 RUNTIME_FUNCTION(Runtime_DeserializeWasmModule) { | 763 RUNTIME_FUNCTION(Runtime_DeserializeWasmModule) { |
| 764 HandleScope shs(isolate); | 764 HandleScope shs(isolate); |
| 765 DCHECK(args.length() == 2); | 765 DCHECK_EQ(2, args.length()); |
| 766 CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, buffer, 0); | 766 CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, buffer, 0); |
| 767 CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, wire_bytes, 1); | 767 CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, wire_bytes, 1); |
| 768 | 768 |
| 769 Address mem_start = static_cast<Address>(buffer->backing_store()); | 769 Address mem_start = static_cast<Address>(buffer->backing_store()); |
| 770 int mem_size = static_cast<int>(buffer->byte_length()->Number()); | 770 int mem_size = static_cast<int>(buffer->byte_length()->Number()); |
| 771 | 771 |
| 772 // DeserializeWasmModule will allocate. We assume JSArrayBuffer doesn't | 772 // DeserializeWasmModule will allocate. We assume JSArrayBuffer doesn't |
| 773 // get relocated. | 773 // get relocated. |
| 774 ScriptData sc(mem_start, mem_size); | 774 ScriptData sc(mem_start, mem_size); |
| 775 bool already_external = wire_bytes->is_external(); | 775 bool already_external = wire_bytes->is_external(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 790 Handle<FixedArray> compiled_module; | 790 Handle<FixedArray> compiled_module; |
| 791 if (!maybe_compiled_module.ToHandle(&compiled_module)) { | 791 if (!maybe_compiled_module.ToHandle(&compiled_module)) { |
| 792 return isolate->heap()->undefined_value(); | 792 return isolate->heap()->undefined_value(); |
| 793 } | 793 } |
| 794 return *WasmModuleObject::New( | 794 return *WasmModuleObject::New( |
| 795 isolate, Handle<WasmCompiledModule>::cast(compiled_module)); | 795 isolate, Handle<WasmCompiledModule>::cast(compiled_module)); |
| 796 } | 796 } |
| 797 | 797 |
| 798 RUNTIME_FUNCTION(Runtime_ValidateWasmInstancesChain) { | 798 RUNTIME_FUNCTION(Runtime_ValidateWasmInstancesChain) { |
| 799 HandleScope shs(isolate); | 799 HandleScope shs(isolate); |
| 800 DCHECK(args.length() == 2); | 800 DCHECK_EQ(2, args.length()); |
| 801 CONVERT_ARG_HANDLE_CHECKED_2(WasmModuleObject, module_obj, 0); | 801 CONVERT_ARG_HANDLE_CHECKED_2(WasmModuleObject, module_obj, 0); |
| 802 CONVERT_ARG_HANDLE_CHECKED(Smi, instance_count, 1); | 802 CONVERT_ARG_HANDLE_CHECKED(Smi, instance_count, 1); |
| 803 wasm::testing::ValidateInstancesChain(isolate, module_obj, | 803 wasm::testing::ValidateInstancesChain(isolate, module_obj, |
| 804 instance_count->value()); | 804 instance_count->value()); |
| 805 return isolate->heap()->ToBoolean(true); | 805 return isolate->heap()->ToBoolean(true); |
| 806 } | 806 } |
| 807 | 807 |
| 808 RUNTIME_FUNCTION(Runtime_ValidateWasmModuleState) { | 808 RUNTIME_FUNCTION(Runtime_ValidateWasmModuleState) { |
| 809 HandleScope shs(isolate); | 809 HandleScope shs(isolate); |
| 810 DCHECK(args.length() == 1); | 810 DCHECK_EQ(1, args.length()); |
| 811 CONVERT_ARG_HANDLE_CHECKED_2(WasmModuleObject, module_obj, 0); | 811 CONVERT_ARG_HANDLE_CHECKED_2(WasmModuleObject, module_obj, 0); |
| 812 wasm::testing::ValidateModuleState(isolate, module_obj); | 812 wasm::testing::ValidateModuleState(isolate, module_obj); |
| 813 return isolate->heap()->ToBoolean(true); | 813 return isolate->heap()->ToBoolean(true); |
| 814 } | 814 } |
| 815 | 815 |
| 816 RUNTIME_FUNCTION(Runtime_ValidateWasmOrphanedInstance) { | 816 RUNTIME_FUNCTION(Runtime_ValidateWasmOrphanedInstance) { |
| 817 HandleScope shs(isolate); | 817 HandleScope shs(isolate); |
| 818 DCHECK(args.length() == 1); | 818 DCHECK_EQ(1, args.length()); |
| 819 CONVERT_ARG_HANDLE_CHECKED_2(WasmInstanceObject, instance, 0); | 819 CONVERT_ARG_HANDLE_CHECKED_2(WasmInstanceObject, instance, 0); |
| 820 wasm::testing::ValidateOrphanedInstance(isolate, instance); | 820 wasm::testing::ValidateOrphanedInstance(isolate, instance); |
| 821 return isolate->heap()->ToBoolean(true); | 821 return isolate->heap()->ToBoolean(true); |
| 822 } | 822 } |
| 823 | 823 |
| 824 } // namespace internal | 824 } // namespace internal |
| 825 } // namespace v8 | 825 } // namespace v8 |
| OLD | NEW |