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" |
11 #include "src/bootstrapper.h" | 11 #include "src/bootstrapper.h" |
12 #include "src/conversions.h" | 12 #include "src/conversions.h" |
13 #include "src/debug/debug.h" | 13 #include "src/debug/debug.h" |
14 #include "src/frames-inl.h" | 14 #include "src/frames-inl.h" |
15 #include "src/isolate-inl.h" | 15 #include "src/isolate-inl.h" |
16 #include "src/messages.h" | 16 #include "src/messages.h" |
17 #include "src/parsing/parse-info.h" | 17 #include "src/parsing/parse-info.h" |
18 #include "src/parsing/parser.h" | 18 #include "src/parsing/parsing.h" |
19 #include "src/wasm/wasm-module.h" | 19 #include "src/wasm/wasm-module.h" |
20 | 20 |
21 namespace v8 { | 21 namespace v8 { |
22 namespace internal { | 22 namespace internal { |
23 | 23 |
24 RUNTIME_FUNCTION(Runtime_CheckIsBootstrapping) { | 24 RUNTIME_FUNCTION(Runtime_CheckIsBootstrapping) { |
25 SealHandleScope shs(isolate); | 25 SealHandleScope shs(isolate); |
26 DCHECK(args.length() == 0); | 26 DCHECK(args.length() == 0); |
27 CHECK(isolate->bootstrapper()->IsActive()); | 27 CHECK(isolate->bootstrapper()->IsActive()); |
28 return isolate->heap()->undefined_value(); | 28 return isolate->heap()->undefined_value(); |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 } | 382 } |
383 } | 383 } |
384 return false; | 384 return false; |
385 } | 385 } |
386 | 386 |
387 | 387 |
388 Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) { | 388 Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) { |
389 MessageLocation location; | 389 MessageLocation location; |
390 if (ComputeLocation(isolate, &location)) { | 390 if (ComputeLocation(isolate, &location)) { |
391 Zone zone(isolate->allocator(), ZONE_NAME); | 391 Zone zone(isolate->allocator(), ZONE_NAME); |
392 std::unique_ptr<ParseInfo> info( | 392 bool successfully_parsed = false; |
393 location.function()->shared()->is_function() | 393 std::unique_ptr<ParseInfo> info; |
394 ? new ParseInfo(&zone, handle(location.function()->shared())) | 394 if (location.function()->shared()->is_function()) { |
395 : new ParseInfo(&zone, location.script())); | 395 info.reset(new ParseInfo(&zone, handle(location.function()->shared()))); |
396 if (Parser::ParseStatic(info.get())) { | 396 successfully_parsed = parsing::ParseFunction(info.get()); |
| 397 } else { |
| 398 info.reset(new ParseInfo(&zone, location.script())); |
| 399 successfully_parsed = parsing::ParseProgram(info.get()); |
| 400 } |
| 401 if (successfully_parsed) { |
397 CallPrinter printer(isolate, | 402 CallPrinter printer(isolate, |
398 location.function()->shared()->IsUserJavaScript()); | 403 location.function()->shared()->IsUserJavaScript()); |
399 Handle<String> str = printer.Print(info->literal(), location.start_pos()); | 404 Handle<String> str = printer.Print(info->literal(), location.start_pos()); |
400 if (str->length() > 0) return str; | 405 if (str->length() > 0) return str; |
401 } else { | 406 } else { |
402 isolate->clear_pending_exception(); | 407 isolate->clear_pending_exception(); |
403 } | 408 } |
404 } | 409 } |
405 return Object::TypeOf(isolate, object); | 410 return Object::TypeOf(isolate, object); |
406 } | 411 } |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 | 538 |
534 RUNTIME_FUNCTION(Runtime_Typeof) { | 539 RUNTIME_FUNCTION(Runtime_Typeof) { |
535 HandleScope scope(isolate); | 540 HandleScope scope(isolate); |
536 DCHECK_EQ(1, args.length()); | 541 DCHECK_EQ(1, args.length()); |
537 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 542 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
538 return *Object::TypeOf(isolate, object); | 543 return *Object::TypeOf(isolate, object); |
539 } | 544 } |
540 | 545 |
541 } // namespace internal | 546 } // namespace internal |
542 } // namespace v8 | 547 } // namespace v8 |
OLD | NEW |