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/messages.h" | 10 #include "src/messages.h" |
(...skipping 530 matching lines...) Loading... |
541 RETURN_NATIVE_CALL(to_string, { obj }); | 541 RETURN_NATIVE_CALL(to_string, { obj }); |
542 } | 542 } |
543 | 543 |
544 | 544 |
545 MaybeHandle<Object> Execution::ToDetailString( | 545 MaybeHandle<Object> Execution::ToDetailString( |
546 Isolate* isolate, Handle<Object> obj) { | 546 Isolate* isolate, Handle<Object> obj) { |
547 RETURN_NATIVE_CALL(to_detail_string, { obj }); | 547 RETURN_NATIVE_CALL(to_detail_string, { obj }); |
548 } | 548 } |
549 | 549 |
550 | 550 |
551 MaybeHandle<Object> Execution::ToObject( | |
552 Isolate* isolate, Handle<Object> obj) { | |
553 if (obj->IsSpecObject()) return obj; | |
554 // TODO(verwaest): Use Object::ToObject but throw an exception on failure. | |
555 RETURN_NATIVE_CALL(to_object, { obj }); | |
556 } | |
557 | |
558 | |
559 MaybeHandle<Object> Execution::ToInteger( | 551 MaybeHandle<Object> Execution::ToInteger( |
560 Isolate* isolate, Handle<Object> obj) { | 552 Isolate* isolate, Handle<Object> obj) { |
561 RETURN_NATIVE_CALL(to_integer, { obj }); | 553 RETURN_NATIVE_CALL(to_integer, { obj }); |
562 } | 554 } |
563 | 555 |
564 | 556 |
565 MaybeHandle<Object> Execution::ToUint32( | 557 MaybeHandle<Object> Execution::ToUint32( |
566 Isolate* isolate, Handle<Object> obj) { | 558 Isolate* isolate, Handle<Object> obj) { |
567 RETURN_NATIVE_CALL(to_uint32, { obj }); | 559 RETURN_NATIVE_CALL(to_uint32, { obj }); |
568 } | 560 } |
(...skipping 13 matching lines...) Loading... |
582 | 574 |
583 MaybeHandle<Object> Execution::NewDate(Isolate* isolate, double time) { | 575 MaybeHandle<Object> Execution::NewDate(Isolate* isolate, double time) { |
584 Handle<Object> time_obj = isolate->factory()->NewNumber(time); | 576 Handle<Object> time_obj = isolate->factory()->NewNumber(time); |
585 RETURN_NATIVE_CALL(create_date, { time_obj }); | 577 RETURN_NATIVE_CALL(create_date, { time_obj }); |
586 } | 578 } |
587 | 579 |
588 | 580 |
589 #undef RETURN_NATIVE_CALL | 581 #undef RETURN_NATIVE_CALL |
590 | 582 |
591 | 583 |
| 584 MaybeHandle<Object> Execution::ToObject(Isolate* isolate, Handle<Object> obj) { |
| 585 Handle<JSReceiver> receiver; |
| 586 if (JSReceiver::ToObject(isolate, obj).ToHandle(&receiver)) { |
| 587 return receiver; |
| 588 } |
| 589 THROW_NEW_ERROR( |
| 590 isolate, NewTypeError(MessageTemplate::kUndefinedOrNullToObject), Object); |
| 591 } |
| 592 |
| 593 |
592 MaybeHandle<JSRegExp> Execution::NewJSRegExp(Handle<String> pattern, | 594 MaybeHandle<JSRegExp> Execution::NewJSRegExp(Handle<String> pattern, |
593 Handle<String> flags) { | 595 Handle<String> flags) { |
594 Isolate* isolate = pattern->GetIsolate(); | 596 Isolate* isolate = pattern->GetIsolate(); |
595 Handle<JSFunction> function = Handle<JSFunction>( | 597 Handle<JSFunction> function = Handle<JSFunction>( |
596 isolate->native_context()->regexp_function()); | 598 isolate->native_context()->regexp_function()); |
597 Handle<Object> re_obj; | 599 Handle<Object> re_obj; |
598 ASSIGN_RETURN_ON_EXCEPTION( | 600 ASSIGN_RETURN_ON_EXCEPTION( |
599 isolate, re_obj, | 601 isolate, re_obj, |
600 RegExpImpl::CreateRegExpLiteral(function, pattern, flags), | 602 RegExpImpl::CreateRegExpLiteral(function, pattern, flags), |
601 JSRegExp); | 603 JSRegExp); |
(...skipping 57 matching lines...) Loading... |
659 | 661 |
660 isolate_->counters()->stack_interrupts()->Increment(); | 662 isolate_->counters()->stack_interrupts()->Increment(); |
661 isolate_->counters()->runtime_profiler_ticks()->Increment(); | 663 isolate_->counters()->runtime_profiler_ticks()->Increment(); |
662 isolate_->runtime_profiler()->OptimizeNow(); | 664 isolate_->runtime_profiler()->OptimizeNow(); |
663 | 665 |
664 return isolate_->heap()->undefined_value(); | 666 return isolate_->heap()->undefined_value(); |
665 } | 667 } |
666 | 668 |
667 } // namespace internal | 669 } // namespace internal |
668 } // namespace v8 | 670 } // namespace v8 |
OLD | NEW |