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 "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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 return isolate->heap()->undefined_value(); | 379 return isolate->heap()->undefined_value(); |
380 } | 380 } |
381 | 381 |
382 | 382 |
383 RUNTIME_FUNCTION(Runtime_HarmonyToString) { | 383 RUNTIME_FUNCTION(Runtime_HarmonyToString) { |
384 // TODO(caitp): Delete this runtime method when removing --harmony-tostring | 384 // TODO(caitp): Delete this runtime method when removing --harmony-tostring |
385 return isolate->heap()->ToBoolean(FLAG_harmony_tostring); | 385 return isolate->heap()->ToBoolean(FLAG_harmony_tostring); |
386 } | 386 } |
387 | 387 |
388 | 388 |
389 RUNTIME_FUNCTION(Runtime_GetTypeFeedbackVector) { | |
390 SealHandleScope shs(isolate); | |
391 DCHECK(args.length() == 1); | |
392 CONVERT_ARG_CHECKED(JSFunction, function, 0); | |
393 return function->shared()->feedback_vector(); | |
394 } | |
395 | |
396 | |
397 RUNTIME_FUNCTION(Runtime_GetCallerJSFunction) { | |
398 SealHandleScope shs(isolate); | |
399 StackFrameIterator it(isolate); | |
400 RUNTIME_ASSERT(it.frame()->type() == StackFrame::STUB); | |
401 it.Advance(); | |
402 RUNTIME_ASSERT(it.frame()->type() == StackFrame::JAVA_SCRIPT); | |
403 return JavaScriptFrame::cast(it.frame())->function(); | |
404 } | |
405 | |
406 | |
407 RUNTIME_FUNCTION(Runtime_GetCodeStubExportsObject) { | |
408 HandleScope shs(isolate); | |
409 return isolate->heap()->code_stub_exports_object(); | |
410 } | |
411 | |
412 | |
413 namespace { | 389 namespace { |
414 | 390 |
415 Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) { | 391 Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) { |
416 MessageLocation location; | 392 MessageLocation location; |
417 if (isolate->ComputeLocation(&location)) { | 393 if (isolate->ComputeLocation(&location)) { |
418 Zone zone; | 394 Zone zone; |
419 base::SmartPointer<ParseInfo> info( | 395 base::SmartPointer<ParseInfo> info( |
420 location.function()->shared()->is_function() | 396 location.function()->shared()->is_function() |
421 ? new ParseInfo(&zone, location.function()) | 397 ? new ParseInfo(&zone, location.function()) |
422 : new ParseInfo(&zone, location.script())); | 398 : new ParseInfo(&zone, location.script())); |
(...skipping 25 matching lines...) Expand all Loading... |
448 HandleScope scope(isolate); | 424 HandleScope scope(isolate); |
449 DCHECK_EQ(1, args.length()); | 425 DCHECK_EQ(1, args.length()); |
450 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 426 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
451 Handle<String> callsite = RenderCallSite(isolate, object); | 427 Handle<String> callsite = RenderCallSite(isolate, object); |
452 THROW_NEW_ERROR_RETURN_FAILURE( | 428 THROW_NEW_ERROR_RETURN_FAILURE( |
453 isolate, NewTypeError(MessageTemplate::kNotConstructor, callsite)); | 429 isolate, NewTypeError(MessageTemplate::kNotConstructor, callsite)); |
454 } | 430 } |
455 | 431 |
456 } // namespace internal | 432 } // namespace internal |
457 } // namespace v8 | 433 } // namespace v8 |
OLD | NEW |