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" |
11 #include "src/frames-inl.h" | 11 #include "src/frames-inl.h" |
12 #include "src/messages.h" | 12 #include "src/messages.h" |
13 #include "src/parser.h" | |
14 #include "src/prettyprinter.h" | |
15 | 13 |
16 namespace v8 { | 14 namespace v8 { |
17 namespace internal { | 15 namespace internal { |
18 | 16 |
19 RUNTIME_FUNCTION(Runtime_CheckIsBootstrapping) { | 17 RUNTIME_FUNCTION(Runtime_CheckIsBootstrapping) { |
20 SealHandleScope shs(isolate); | 18 SealHandleScope shs(isolate); |
21 DCHECK(args.length() == 0); | 19 DCHECK(args.length() == 0); |
22 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive()); | 20 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive()); |
23 return isolate->heap()->undefined_value(); | 21 return isolate->heap()->undefined_value(); |
24 } | 22 } |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 RETURN_FAILURE_ON_EXCEPTION( | 248 RETURN_FAILURE_ON_EXCEPTION( |
251 isolate, isolate->CaptureAndSetDetailedStackTrace(error_object)); | 249 isolate, isolate->CaptureAndSetDetailedStackTrace(error_object)); |
252 // Capture a simple stack trace for the stack property. | 250 // Capture a simple stack trace for the stack property. |
253 RETURN_FAILURE_ON_EXCEPTION( | 251 RETURN_FAILURE_ON_EXCEPTION( |
254 isolate, isolate->CaptureAndSetSimpleStackTrace(error_object, caller)); | 252 isolate, isolate->CaptureAndSetSimpleStackTrace(error_object, caller)); |
255 } | 253 } |
256 return isolate->heap()->undefined_value(); | 254 return isolate->heap()->undefined_value(); |
257 } | 255 } |
258 | 256 |
259 | 257 |
260 RUNTIME_FUNCTION(Runtime_RenderCallSite) { | |
261 HandleScope scope(isolate); | |
262 DCHECK(args.length() == 0); | |
263 MessageLocation location; | |
264 if (!isolate->ComputeLocation(&location)) { | |
265 return isolate->heap()->empty_string(); | |
266 } | |
267 | |
268 Zone zone; | |
269 base::SmartPointer<ParseInfo> info( | |
270 location.function()->shared()->is_function() | |
271 ? new ParseInfo(&zone, location.function()) | |
272 : new ParseInfo(&zone, location.script())); | |
273 | |
274 if (!Parser::ParseStatic(info.get())) { | |
275 isolate->clear_pending_exception(); | |
276 return isolate->heap()->empty_string(); | |
277 } | |
278 CallPrinter printer(isolate, &zone); | |
279 const char* string = printer.Print(info->literal(), location.start_pos()); | |
280 return *isolate->factory()->NewStringFromAsciiChecked(string); | |
281 } | |
282 | |
283 | |
284 RUNTIME_FUNCTION(Runtime_MessageGetStartPosition) { | 258 RUNTIME_FUNCTION(Runtime_MessageGetStartPosition) { |
285 SealHandleScope shs(isolate); | 259 SealHandleScope shs(isolate); |
286 DCHECK(args.length() == 1); | 260 DCHECK(args.length() == 1); |
287 CONVERT_ARG_CHECKED(JSMessageObject, message, 0); | 261 CONVERT_ARG_CHECKED(JSMessageObject, message, 0); |
288 return Smi::FromInt(message->start_position()); | 262 return Smi::FromInt(message->start_position()); |
289 } | 263 } |
290 | 264 |
291 | 265 |
292 RUNTIME_FUNCTION(Runtime_MessageGetScript) { | 266 RUNTIME_FUNCTION(Runtime_MessageGetScript) { |
293 SealHandleScope shs(isolate); | 267 SealHandleScope shs(isolate); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 } | 393 } |
420 | 394 |
421 | 395 |
422 RUNTIME_FUNCTION(Runtime_GetCodeStubExportsObject) { | 396 RUNTIME_FUNCTION(Runtime_GetCodeStubExportsObject) { |
423 HandleScope shs(isolate); | 397 HandleScope shs(isolate); |
424 return isolate->heap()->code_stub_exports_object(); | 398 return isolate->heap()->code_stub_exports_object(); |
425 } | 399 } |
426 | 400 |
427 } // namespace internal | 401 } // namespace internal |
428 } // namespace v8 | 402 } // namespace v8 |
OLD | NEW |