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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/deoptimizer.h" | 8 #include "src/deoptimizer.h" |
9 #include "src/full-codegen.h" | 9 #include "src/full-codegen.h" |
10 #include "src/runtime/runtime.h" | 10 #include "src/runtime/runtime.h" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 345 |
346 RUNTIME_FUNCTION(Runtime_TraceExit) { | 346 RUNTIME_FUNCTION(Runtime_TraceExit) { |
347 SealHandleScope shs(isolate); | 347 SealHandleScope shs(isolate); |
348 DCHECK(args.length() == 1); | 348 DCHECK(args.length() == 1); |
349 CONVERT_ARG_CHECKED(Object, obj, 0); | 349 CONVERT_ARG_CHECKED(Object, obj, 0); |
350 PrintTransition(isolate, obj); | 350 PrintTransition(isolate, obj); |
351 return obj; // return TOS | 351 return obj; // return TOS |
352 } | 352 } |
353 | 353 |
354 | 354 |
355 #ifdef DEBUG | |
356 // ListNatives is ONLY used by the fuzz-natives.js in debug mode | |
357 // Exclude the code in release mode. | |
358 RUNTIME_FUNCTION(Runtime_ListNatives) { | |
359 HandleScope scope(isolate); | |
360 DCHECK(args.length() == 0); | |
361 #define COUNT_ENTRY(Name, argc, ressize) +1 | |
362 int entry_count = | |
363 0 RUNTIME_FUNCTION_LIST(COUNT_ENTRY) INLINE_FUNCTION_LIST(COUNT_ENTRY) | |
364 INLINE_OPTIMIZED_FUNCTION_LIST(COUNT_ENTRY); | |
365 #undef COUNT_ENTRY | |
366 Factory* factory = isolate->factory(); | |
367 Handle<FixedArray> elements = factory->NewFixedArray(entry_count); | |
368 int index = 0; | |
369 bool inline_runtime_functions = false; | |
370 #define ADD_ENTRY(Name, argc, ressize) \ | |
371 { \ | |
372 HandleScope inner(isolate); \ | |
373 Handle<String> name; \ | |
374 /* Inline runtime functions have an underscore in front of the name. */ \ | |
375 if (inline_runtime_functions) { \ | |
376 name = factory->NewStringFromStaticChars("_" #Name); \ | |
377 } else { \ | |
378 name = factory->NewStringFromStaticChars(#Name); \ | |
379 } \ | |
380 Handle<FixedArray> pair_elements = factory->NewFixedArray(2); \ | |
381 pair_elements->set(0, *name); \ | |
382 pair_elements->set(1, Smi::FromInt(argc)); \ | |
383 Handle<JSArray> pair = factory->NewJSArrayWithElements(pair_elements); \ | |
384 elements->set(index++, *pair); \ | |
385 } | |
386 inline_runtime_functions = false; | |
387 RUNTIME_FUNCTION_LIST(ADD_ENTRY) | |
388 INLINE_OPTIMIZED_FUNCTION_LIST(ADD_ENTRY) | |
389 inline_runtime_functions = true; | |
390 INLINE_FUNCTION_LIST(ADD_ENTRY) | |
391 #undef ADD_ENTRY | |
392 DCHECK_EQ(index, entry_count); | |
393 Handle<JSArray> result = factory->NewJSArrayWithElements(elements); | |
394 return *result; | |
395 } | |
396 #endif | |
397 | |
398 | |
399 RUNTIME_FUNCTION(Runtime_HaveSameMap) { | 355 RUNTIME_FUNCTION(Runtime_HaveSameMap) { |
400 SealHandleScope shs(isolate); | 356 SealHandleScope shs(isolate); |
401 DCHECK(args.length() == 2); | 357 DCHECK(args.length() == 2); |
402 CONVERT_ARG_CHECKED(JSObject, obj1, 0); | 358 CONVERT_ARG_CHECKED(JSObject, obj1, 0); |
403 CONVERT_ARG_CHECKED(JSObject, obj2, 1); | 359 CONVERT_ARG_CHECKED(JSObject, obj2, 1); |
404 return isolate->heap()->ToBoolean(obj1->map() == obj2->map()); | 360 return isolate->heap()->ToBoolean(obj1->map() == obj2->map()); |
405 } | 361 } |
406 | 362 |
407 | 363 |
408 #define ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(Name) \ | 364 #define ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(Name) \ |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 RUNTIME_FUNCTION(Runtime_HasFixed##Type##Elements) { \ | 396 RUNTIME_FUNCTION(Runtime_HasFixed##Type##Elements) { \ |
441 CONVERT_ARG_CHECKED(JSObject, obj, 0); \ | 397 CONVERT_ARG_CHECKED(JSObject, obj, 0); \ |
442 return isolate->heap()->ToBoolean(obj->HasFixed##Type##Elements()); \ | 398 return isolate->heap()->ToBoolean(obj->HasFixed##Type##Elements()); \ |
443 } | 399 } |
444 | 400 |
445 TYPED_ARRAYS(FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION) | 401 TYPED_ARRAYS(FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION) |
446 | 402 |
447 #undef FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION | 403 #undef FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION |
448 } | 404 } |
449 } // namespace v8::internal | 405 } // namespace v8::internal |
OLD | NEW |