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/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 | 417 |
418 Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) { | 418 Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) { |
419 MessageLocation location; | 419 MessageLocation location; |
420 if (isolate->ComputeLocation(&location)) { | 420 if (isolate->ComputeLocation(&location)) { |
421 Zone zone; | 421 Zone zone; |
422 base::SmartPointer<ParseInfo> info( | 422 base::SmartPointer<ParseInfo> info( |
423 location.function()->shared()->is_function() | 423 location.function()->shared()->is_function() |
424 ? new ParseInfo(&zone, location.function()) | 424 ? new ParseInfo(&zone, location.function()) |
425 : new ParseInfo(&zone, location.script())); | 425 : new ParseInfo(&zone, location.script())); |
426 if (Parser::ParseStatic(info.get())) { | 426 if (Parser::ParseStatic(info.get())) { |
427 CallPrinter printer(isolate, &zone); | 427 CallPrinter printer(isolate); |
428 const char* string = printer.Print(info->literal(), location.start_pos()); | 428 const char* string = printer.Print(info->literal(), location.start_pos()); |
429 return isolate->factory()->NewStringFromAsciiChecked(string); | 429 return isolate->factory()->NewStringFromAsciiChecked(string); |
430 } else { | 430 } else { |
431 isolate->clear_pending_exception(); | 431 isolate->clear_pending_exception(); |
432 } | 432 } |
433 } | 433 } |
434 return Object::TypeOf(isolate, object); | 434 return Object::TypeOf(isolate, object); |
435 } | 435 } |
436 | 436 |
437 } // namespace | 437 } // namespace |
438 | 438 |
439 | 439 |
440 RUNTIME_FUNCTION(Runtime_ThrowCalledNonCallable) { | 440 RUNTIME_FUNCTION(Runtime_ThrowCalledNonCallable) { |
441 HandleScope scope(isolate); | 441 HandleScope scope(isolate); |
442 DCHECK_EQ(1, args.length()); | 442 DCHECK_EQ(1, args.length()); |
443 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 443 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
444 Handle<String> callsite = RenderCallSite(isolate, object); | 444 Handle<String> callsite = RenderCallSite(isolate, object); |
445 THROW_NEW_ERROR_RETURN_FAILURE( | 445 THROW_NEW_ERROR_RETURN_FAILURE( |
446 isolate, NewTypeError(MessageTemplate::kCalledNonCallable, callsite)); | 446 isolate, NewTypeError(MessageTemplate::kCalledNonCallable, callsite)); |
447 } | 447 } |
448 | 448 |
449 } // namespace internal | 449 } // namespace internal |
450 } // namespace v8 | 450 } // namespace v8 |
OLD | NEW |