| 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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 MaybeHandle<Object> Execution::NewDate(Isolate* isolate, double time) { | 550 MaybeHandle<Object> Execution::NewDate(Isolate* isolate, double time) { |
| 551 Handle<Object> time_obj = isolate->factory()->NewNumber(time); | 551 Handle<Object> time_obj = isolate->factory()->NewNumber(time); |
| 552 RETURN_NATIVE_CALL(create_date, { time_obj }); | 552 RETURN_NATIVE_CALL(create_date, { time_obj }); |
| 553 } | 553 } |
| 554 | 554 |
| 555 | 555 |
| 556 #undef RETURN_NATIVE_CALL | 556 #undef RETURN_NATIVE_CALL |
| 557 | 557 |
| 558 | 558 |
| 559 MaybeHandle<Object> Execution::ToInt32(Isolate* isolate, Handle<Object> obj) { | 559 MaybeHandle<Object> Execution::ToInt32(Isolate* isolate, Handle<Object> obj) { |
| 560 ASSIGN_RETURN_ON_EXCEPTION(isolate, obj, Object::ToNumber(isolate, obj), | 560 ASSIGN_RETURN_ON_EXCEPTION(isolate, obj, Object::ToNumber(obj), Object); |
| 561 Object); | |
| 562 return isolate->factory()->NewNumberFromInt(DoubleToInt32(obj->Number())); | 561 return isolate->factory()->NewNumberFromInt(DoubleToInt32(obj->Number())); |
| 563 } | 562 } |
| 564 | 563 |
| 565 | 564 |
| 566 MaybeHandle<Object> Execution::ToObject(Isolate* isolate, Handle<Object> obj) { | 565 MaybeHandle<Object> Execution::ToObject(Isolate* isolate, Handle<Object> obj) { |
| 567 Handle<JSReceiver> receiver; | 566 Handle<JSReceiver> receiver; |
| 568 if (JSReceiver::ToObject(isolate, obj).ToHandle(&receiver)) { | 567 if (JSReceiver::ToObject(isolate, obj).ToHandle(&receiver)) { |
| 569 return receiver; | 568 return receiver; |
| 570 } | 569 } |
| 571 THROW_NEW_ERROR( | 570 THROW_NEW_ERROR( |
| 572 isolate, NewTypeError(MessageTemplate::kUndefinedOrNullToObject), Object); | 571 isolate, NewTypeError(MessageTemplate::kUndefinedOrNullToObject), Object); |
| 573 } | 572 } |
| 574 | 573 |
| 575 | 574 |
| 576 MaybeHandle<Object> Execution::ToUint32(Isolate* isolate, Handle<Object> obj) { | 575 MaybeHandle<Object> Execution::ToUint32(Isolate* isolate, Handle<Object> obj) { |
| 577 ASSIGN_RETURN_ON_EXCEPTION(isolate, obj, Object::ToNumber(isolate, obj), | 576 ASSIGN_RETURN_ON_EXCEPTION(isolate, obj, Object::ToNumber(obj), Object); |
| 578 Object); | |
| 579 return isolate->factory()->NewNumberFromUint(DoubleToUint32(obj->Number())); | 577 return isolate->factory()->NewNumberFromUint(DoubleToUint32(obj->Number())); |
| 580 } | 578 } |
| 581 | 579 |
| 582 | 580 |
| 583 MaybeHandle<JSRegExp> Execution::NewJSRegExp(Handle<String> pattern, | 581 MaybeHandle<JSRegExp> Execution::NewJSRegExp(Handle<String> pattern, |
| 584 Handle<String> flags) { | 582 Handle<String> flags) { |
| 585 Isolate* isolate = pattern->GetIsolate(); | 583 Isolate* isolate = pattern->GetIsolate(); |
| 586 Handle<JSFunction> function = Handle<JSFunction>( | 584 Handle<JSFunction> function = Handle<JSFunction>( |
| 587 isolate->native_context()->regexp_function()); | 585 isolate->native_context()->regexp_function()); |
| 588 Handle<Object> re_obj; | 586 Handle<Object> re_obj; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 | 646 |
| 649 isolate_->counters()->stack_interrupts()->Increment(); | 647 isolate_->counters()->stack_interrupts()->Increment(); |
| 650 isolate_->counters()->runtime_profiler_ticks()->Increment(); | 648 isolate_->counters()->runtime_profiler_ticks()->Increment(); |
| 651 isolate_->runtime_profiler()->OptimizeNow(); | 649 isolate_->runtime_profiler()->OptimizeNow(); |
| 652 | 650 |
| 653 return isolate_->heap()->undefined_value(); | 651 return isolate_->heap()->undefined_value(); |
| 654 } | 652 } |
| 655 | 653 |
| 656 } // namespace internal | 654 } // namespace internal |
| 657 } // namespace v8 | 655 } // namespace v8 |
| OLD | NEW |