| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 } | 345 } |
| 346 } | 346 } |
| 347 return false; | 347 return false; |
| 348 } | 348 } |
| 349 | 349 |
| 350 | 350 |
| 351 Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) { | 351 Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) { |
| 352 MessageLocation location; | 352 MessageLocation location; |
| 353 if (ComputeLocation(isolate, &location)) { | 353 if (ComputeLocation(isolate, &location)) { |
| 354 Zone zone(isolate->allocator(), ZONE_NAME); | 354 Zone zone(isolate->allocator(), ZONE_NAME); |
| 355 std::unique_ptr<ParseInfo> info; | 355 std::unique_ptr<ParseInfo> info( |
| 356 if (location.function()->shared()->is_function()) { | 356 new ParseInfo(&zone, handle(location.function()->shared()))); |
| 357 info.reset(new ParseInfo(&zone, handle(location.function()->shared()))); | |
| 358 } else { | |
| 359 info.reset(new ParseInfo(&zone, location.script())); | |
| 360 } | |
| 361 if (parsing::ParseAny(info.get())) { | 357 if (parsing::ParseAny(info.get())) { |
| 362 CallPrinter printer(isolate, | 358 CallPrinter printer(isolate, |
| 363 location.function()->shared()->IsUserJavaScript()); | 359 location.function()->shared()->IsUserJavaScript()); |
| 364 Handle<String> str = printer.Print(info->literal(), location.start_pos()); | 360 Handle<String> str = printer.Print(info->literal(), location.start_pos()); |
| 365 if (str->length() > 0) return str; | 361 if (str->length() > 0) return str; |
| 366 } else { | 362 } else { |
| 367 isolate->clear_pending_exception(); | 363 isolate->clear_pending_exception(); |
| 368 } | 364 } |
| 369 } | 365 } |
| 370 return Object::TypeOf(isolate, object); | 366 return Object::TypeOf(isolate, object); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 | 485 |
| 490 RUNTIME_FUNCTION(Runtime_Typeof) { | 486 RUNTIME_FUNCTION(Runtime_Typeof) { |
| 491 HandleScope scope(isolate); | 487 HandleScope scope(isolate); |
| 492 DCHECK_EQ(1, args.length()); | 488 DCHECK_EQ(1, args.length()); |
| 493 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 489 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
| 494 return *Object::TypeOf(isolate, object); | 490 return *Object::TypeOf(isolate, object); |
| 495 } | 491 } |
| 496 | 492 |
| 497 } // namespace internal | 493 } // namespace internal |
| 498 } // namespace v8 | 494 } // namespace v8 |
| OLD | NEW |