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