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/execution.h" | 5 #include "src/execution.h" |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 MaybeHandle<Object> Execution::ToObject(Isolate* isolate, Handle<Object> obj) { | 450 MaybeHandle<Object> Execution::ToObject(Isolate* isolate, Handle<Object> obj) { |
451 Handle<JSReceiver> receiver; | 451 Handle<JSReceiver> receiver; |
452 if (JSReceiver::ToObject(isolate, obj).ToHandle(&receiver)) { | 452 if (JSReceiver::ToObject(isolate, obj).ToHandle(&receiver)) { |
453 return receiver; | 453 return receiver; |
454 } | 454 } |
455 THROW_NEW_ERROR( | 455 THROW_NEW_ERROR( |
456 isolate, NewTypeError(MessageTemplate::kUndefinedOrNullToObject), Object); | 456 isolate, NewTypeError(MessageTemplate::kUndefinedOrNullToObject), Object); |
457 } | 457 } |
458 | 458 |
459 | 459 |
460 MaybeHandle<JSRegExp> Execution::NewJSRegExp(Handle<String> pattern, | |
461 Handle<String> flags) { | |
462 Isolate* isolate = pattern->GetIsolate(); | |
463 Handle<JSFunction> function = Handle<JSFunction>( | |
464 isolate->native_context()->regexp_function()); | |
465 Handle<Object> re_obj; | |
466 ASSIGN_RETURN_ON_EXCEPTION( | |
467 isolate, re_obj, | |
468 RegExpImpl::CreateRegExpLiteral(function, pattern, flags), | |
469 JSRegExp); | |
470 return Handle<JSRegExp>::cast(re_obj); | |
471 } | |
472 | |
473 | |
474 Handle<String> Execution::GetStackTraceLine(Handle<Object> recv, | 460 Handle<String> Execution::GetStackTraceLine(Handle<Object> recv, |
475 Handle<JSFunction> fun, | 461 Handle<JSFunction> fun, |
476 Handle<Object> pos, | 462 Handle<Object> pos, |
477 Handle<Object> is_global) { | 463 Handle<Object> is_global) { |
478 Isolate* isolate = fun->GetIsolate(); | 464 Isolate* isolate = fun->GetIsolate(); |
479 Handle<Object> args[] = { recv, fun, pos, is_global }; | 465 Handle<Object> args[] = { recv, fun, pos, is_global }; |
480 MaybeHandle<Object> maybe_result = | 466 MaybeHandle<Object> maybe_result = |
481 TryCall(isolate, isolate->get_stack_trace_line_fun(), | 467 TryCall(isolate, isolate->get_stack_trace_line_fun(), |
482 isolate->factory()->undefined_value(), arraysize(args), args); | 468 isolate->factory()->undefined_value(), arraysize(args), args); |
483 Handle<Object> result; | 469 Handle<Object> result; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 | 516 |
531 isolate_->counters()->stack_interrupts()->Increment(); | 517 isolate_->counters()->stack_interrupts()->Increment(); |
532 isolate_->counters()->runtime_profiler_ticks()->Increment(); | 518 isolate_->counters()->runtime_profiler_ticks()->Increment(); |
533 isolate_->runtime_profiler()->OptimizeNow(); | 519 isolate_->runtime_profiler()->OptimizeNow(); |
534 | 520 |
535 return isolate_->heap()->undefined_value(); | 521 return isolate_->heap()->undefined_value(); |
536 } | 522 } |
537 | 523 |
538 } // namespace internal | 524 } // namespace internal |
539 } // namespace v8 | 525 } // namespace v8 |
OLD | NEW |