OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 5557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5568 return Utils::ToLocal(obj); | 5568 return Utils::ToLocal(obj); |
5569 } | 5569 } |
5570 | 5570 |
5571 | 5571 |
5572 Local<v8::Value> v8::NumberObject::New(Isolate* isolate, double value) { | 5572 Local<v8::Value> v8::NumberObject::New(Isolate* isolate, double value) { |
5573 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 5573 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
5574 EnsureInitializedForIsolate(i_isolate, "v8::NumberObject::New()"); | 5574 EnsureInitializedForIsolate(i_isolate, "v8::NumberObject::New()"); |
5575 LOG_API(i_isolate, "NumberObject::New"); | 5575 LOG_API(i_isolate, "NumberObject::New"); |
5576 ENTER_V8(i_isolate); | 5576 ENTER_V8(i_isolate); |
5577 i::Handle<i::Object> number = i_isolate->factory()->NewNumber(value); | 5577 i::Handle<i::Object> number = i_isolate->factory()->NewNumber(value); |
5578 i::Handle<i::Object> obj = i_isolate->factory()->ToObject(number); | 5578 i::Handle<i::Object> obj = i::Object::ToObject(i_isolate, number); |
5579 return Utils::ToLocal(obj); | 5579 return Utils::ToLocal(obj); |
5580 } | 5580 } |
5581 | 5581 |
5582 | 5582 |
5583 double v8::NumberObject::ValueOf() const { | 5583 double v8::NumberObject::ValueOf() const { |
5584 i::Isolate* isolate = i::Isolate::Current(); | 5584 i::Isolate* isolate = i::Isolate::Current(); |
5585 LOG_API(isolate, "NumberObject::NumberValue"); | 5585 LOG_API(isolate, "NumberObject::NumberValue"); |
5586 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 5586 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
5587 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); | 5587 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); |
5588 return jsvalue->value()->Number(); | 5588 return jsvalue->value()->Number(); |
5589 } | 5589 } |
5590 | 5590 |
5591 | 5591 |
5592 Local<v8::Value> v8::BooleanObject::New(bool value) { | 5592 Local<v8::Value> v8::BooleanObject::New(bool value) { |
5593 i::Isolate* isolate = i::Isolate::Current(); | 5593 i::Isolate* isolate = i::Isolate::Current(); |
5594 EnsureInitializedForIsolate(isolate, "v8::BooleanObject::New()"); | 5594 EnsureInitializedForIsolate(isolate, "v8::BooleanObject::New()"); |
5595 LOG_API(isolate, "BooleanObject::New"); | 5595 LOG_API(isolate, "BooleanObject::New"); |
5596 ENTER_V8(isolate); | 5596 ENTER_V8(isolate); |
5597 i::Handle<i::Object> boolean(value | 5597 i::Handle<i::Object> boolean(value |
5598 ? isolate->heap()->true_value() | 5598 ? isolate->heap()->true_value() |
5599 : isolate->heap()->false_value(), | 5599 : isolate->heap()->false_value(), |
5600 isolate); | 5600 isolate); |
5601 i::Handle<i::Object> obj = isolate->factory()->ToObject(boolean); | 5601 i::Handle<i::Object> obj = i::Object::ToObject(isolate, boolean); |
5602 return Utils::ToLocal(obj); | 5602 return Utils::ToLocal(obj); |
5603 } | 5603 } |
5604 | 5604 |
5605 | 5605 |
5606 bool v8::BooleanObject::ValueOf() const { | 5606 bool v8::BooleanObject::ValueOf() const { |
5607 i::Isolate* isolate = i::Isolate::Current(); | 5607 i::Isolate* isolate = i::Isolate::Current(); |
5608 LOG_API(isolate, "BooleanObject::BooleanValue"); | 5608 LOG_API(isolate, "BooleanObject::BooleanValue"); |
5609 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 5609 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
5610 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); | 5610 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); |
5611 return jsvalue->value()->IsTrue(); | 5611 return jsvalue->value()->IsTrue(); |
5612 } | 5612 } |
5613 | 5613 |
5614 | 5614 |
5615 Local<v8::Value> v8::StringObject::New(Handle<String> value) { | 5615 Local<v8::Value> v8::StringObject::New(Handle<String> value) { |
5616 i::Isolate* isolate = i::Isolate::Current(); | 5616 i::Isolate* isolate = i::Isolate::Current(); |
5617 EnsureInitializedForIsolate(isolate, "v8::StringObject::New()"); | 5617 EnsureInitializedForIsolate(isolate, "v8::StringObject::New()"); |
5618 LOG_API(isolate, "StringObject::New"); | 5618 LOG_API(isolate, "StringObject::New"); |
5619 ENTER_V8(isolate); | 5619 ENTER_V8(isolate); |
5620 i::Handle<i::Object> obj = | 5620 i::Handle<i::Object> obj = i::Object::ToObject( |
5621 isolate->factory()->ToObject(Utils::OpenHandle(*value)); | 5621 isolate, Utils::OpenHandle(*value)); |
5622 return Utils::ToLocal(obj); | 5622 return Utils::ToLocal(obj); |
5623 } | 5623 } |
5624 | 5624 |
5625 | 5625 |
5626 Local<v8::String> v8::StringObject::ValueOf() const { | 5626 Local<v8::String> v8::StringObject::ValueOf() const { |
5627 i::Isolate* isolate = i::Isolate::Current(); | 5627 i::Isolate* isolate = i::Isolate::Current(); |
5628 LOG_API(isolate, "StringObject::StringValue"); | 5628 LOG_API(isolate, "StringObject::StringValue"); |
5629 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 5629 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
5630 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); | 5630 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); |
5631 return Utils::ToLocal( | 5631 return Utils::ToLocal( |
5632 i::Handle<i::String>(i::String::cast(jsvalue->value()))); | 5632 i::Handle<i::String>(i::String::cast(jsvalue->value()))); |
5633 } | 5633 } |
5634 | 5634 |
5635 | 5635 |
5636 Local<v8::Value> v8::SymbolObject::New(Isolate* isolate, Handle<Symbol> value) { | 5636 Local<v8::Value> v8::SymbolObject::New(Isolate* isolate, Handle<Symbol> value) { |
5637 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 5637 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
5638 EnsureInitializedForIsolate(i_isolate, "v8::SymbolObject::New()"); | 5638 EnsureInitializedForIsolate(i_isolate, "v8::SymbolObject::New()"); |
5639 LOG_API(i_isolate, "SymbolObject::New"); | 5639 LOG_API(i_isolate, "SymbolObject::New"); |
5640 ENTER_V8(i_isolate); | 5640 ENTER_V8(i_isolate); |
5641 i::Handle<i::Object> obj = | 5641 i::Handle<i::Object> obj = i::Object::ToObject( |
5642 i_isolate->factory()->ToObject(Utils::OpenHandle(*value)); | 5642 i_isolate, Utils::OpenHandle(*value)); |
5643 return Utils::ToLocal(obj); | 5643 return Utils::ToLocal(obj); |
5644 } | 5644 } |
5645 | 5645 |
5646 | 5646 |
5647 Local<v8::Symbol> v8::SymbolObject::ValueOf() const { | 5647 Local<v8::Symbol> v8::SymbolObject::ValueOf() const { |
5648 i::Isolate* isolate = i::Isolate::Current(); | 5648 i::Isolate* isolate = i::Isolate::Current(); |
5649 LOG_API(isolate, "SymbolObject::SymbolValue"); | 5649 LOG_API(isolate, "SymbolObject::SymbolValue"); |
5650 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 5650 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
5651 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); | 5651 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); |
5652 return Utils::ToLocal( | 5652 return Utils::ToLocal( |
(...skipping 1997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7650 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7650 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7651 Address callback_address = | 7651 Address callback_address = |
7652 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7652 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7653 VMState<EXTERNAL> state(isolate); | 7653 VMState<EXTERNAL> state(isolate); |
7654 ExternalCallbackScope call_scope(isolate, callback_address); | 7654 ExternalCallbackScope call_scope(isolate, callback_address); |
7655 callback(info); | 7655 callback(info); |
7656 } | 7656 } |
7657 | 7657 |
7658 | 7658 |
7659 } } // namespace v8::internal | 7659 } } // namespace v8::internal |
OLD | NEW |