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/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) { | 404 Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) { |
405 MessageLocation location; | 405 MessageLocation location; |
406 if (ComputeLocation(isolate, &location)) { | 406 if (ComputeLocation(isolate, &location)) { |
407 Zone zone(isolate->allocator()); | 407 Zone zone(isolate->allocator()); |
408 std::unique_ptr<ParseInfo> info( | 408 std::unique_ptr<ParseInfo> info( |
409 location.function()->shared()->is_function() | 409 location.function()->shared()->is_function() |
410 ? new ParseInfo(&zone, location.function()) | 410 ? new ParseInfo(&zone, location.function()) |
411 : new ParseInfo(&zone, location.script())); | 411 : new ParseInfo(&zone, location.script())); |
412 if (Parser::ParseStatic(info.get())) { | 412 if (Parser::ParseStatic(info.get())) { |
413 CallPrinter printer(isolate, location.function()->shared()->IsBuiltin()); | 413 CallPrinter printer(isolate, location.function()->shared()->IsBuiltin()); |
414 const char* string = printer.Print(info->literal(), location.start_pos()); | 414 Handle<String> str = printer.Print(info->literal(), location.start_pos()); |
415 if (strlen(string) > 0) { | 415 if (str->length() > 0) return str; |
416 return isolate->factory()->NewStringFromAsciiChecked(string); | |
417 } | |
418 } else { | 416 } else { |
419 isolate->clear_pending_exception(); | 417 isolate->clear_pending_exception(); |
420 } | 418 } |
421 } | 419 } |
422 return Object::TypeOf(isolate, object); | 420 return Object::TypeOf(isolate, object); |
423 } | 421 } |
424 | 422 |
425 } // namespace | 423 } // namespace |
426 | 424 |
427 | 425 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 | 563 |
566 RUNTIME_FUNCTION(Runtime_Typeof) { | 564 RUNTIME_FUNCTION(Runtime_Typeof) { |
567 HandleScope scope(isolate); | 565 HandleScope scope(isolate); |
568 DCHECK_EQ(1, args.length()); | 566 DCHECK_EQ(1, args.length()); |
569 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 567 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
570 return *Object::TypeOf(isolate, object); | 568 return *Object::TypeOf(isolate, object); |
571 } | 569 } |
572 | 570 |
573 } // namespace internal | 571 } // namespace internal |
574 } // namespace v8 | 572 } // namespace v8 |
OLD | NEW |