Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: src/api.cc

Issue 235943007: Handlify Object::ToObject. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5561 matching lines...) Expand 10 before | Expand all | Expand 10 after
5572 return Utils::ToLocal(obj); 5572 return Utils::ToLocal(obj);
5573 } 5573 }
5574 5574
5575 5575
5576 Local<v8::Value> v8::NumberObject::New(Isolate* isolate, double value) { 5576 Local<v8::Value> v8::NumberObject::New(Isolate* isolate, double value) {
5577 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 5577 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
5578 EnsureInitializedForIsolate(i_isolate, "v8::NumberObject::New()"); 5578 EnsureInitializedForIsolate(i_isolate, "v8::NumberObject::New()");
5579 LOG_API(i_isolate, "NumberObject::New"); 5579 LOG_API(i_isolate, "NumberObject::New");
5580 ENTER_V8(i_isolate); 5580 ENTER_V8(i_isolate);
5581 i::Handle<i::Object> number = i_isolate->factory()->NewNumber(value); 5581 i::Handle<i::Object> number = i_isolate->factory()->NewNumber(value);
5582 i::Handle<i::Object> obj = i_isolate->factory()->ToObject(number); 5582 i::Handle<i::Object> obj =
5583 i::Object::ToObject(i_isolate, number).ToHandleChecked();
5583 return Utils::ToLocal(obj); 5584 return Utils::ToLocal(obj);
5584 } 5585 }
5585 5586
5586 5587
5587 double v8::NumberObject::ValueOf() const { 5588 double v8::NumberObject::ValueOf() const {
5588 i::Isolate* isolate = i::Isolate::Current(); 5589 i::Isolate* isolate = i::Isolate::Current();
5589 LOG_API(isolate, "NumberObject::NumberValue"); 5590 LOG_API(isolate, "NumberObject::NumberValue");
5590 i::Handle<i::Object> obj = Utils::OpenHandle(this); 5591 i::Handle<i::Object> obj = Utils::OpenHandle(this);
5591 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); 5592 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj);
5592 return jsvalue->value()->Number(); 5593 return jsvalue->value()->Number();
5593 } 5594 }
5594 5595
5595 5596
5596 Local<v8::Value> v8::BooleanObject::New(bool value) { 5597 Local<v8::Value> v8::BooleanObject::New(bool value) {
5597 i::Isolate* isolate = i::Isolate::Current(); 5598 i::Isolate* isolate = i::Isolate::Current();
5598 EnsureInitializedForIsolate(isolate, "v8::BooleanObject::New()"); 5599 EnsureInitializedForIsolate(isolate, "v8::BooleanObject::New()");
5599 LOG_API(isolate, "BooleanObject::New"); 5600 LOG_API(isolate, "BooleanObject::New");
5600 ENTER_V8(isolate); 5601 ENTER_V8(isolate);
5601 i::Handle<i::Object> boolean(value 5602 i::Handle<i::Object> boolean(value
5602 ? isolate->heap()->true_value() 5603 ? isolate->heap()->true_value()
5603 : isolate->heap()->false_value(), 5604 : isolate->heap()->false_value(),
5604 isolate); 5605 isolate);
5605 i::Handle<i::Object> obj = isolate->factory()->ToObject(boolean); 5606 i::Handle<i::Object> obj =
5607 i::Object::ToObject(isolate, boolean).ToHandleChecked();
5606 return Utils::ToLocal(obj); 5608 return Utils::ToLocal(obj);
5607 } 5609 }
5608 5610
5609 5611
5610 bool v8::BooleanObject::ValueOf() const { 5612 bool v8::BooleanObject::ValueOf() const {
5611 i::Isolate* isolate = i::Isolate::Current(); 5613 i::Isolate* isolate = i::Isolate::Current();
5612 LOG_API(isolate, "BooleanObject::BooleanValue"); 5614 LOG_API(isolate, "BooleanObject::BooleanValue");
5613 i::Handle<i::Object> obj = Utils::OpenHandle(this); 5615 i::Handle<i::Object> obj = Utils::OpenHandle(this);
5614 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); 5616 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj);
5615 return jsvalue->value()->IsTrue(); 5617 return jsvalue->value()->IsTrue();
5616 } 5618 }
5617 5619
5618 5620
5619 Local<v8::Value> v8::StringObject::New(Handle<String> value) { 5621 Local<v8::Value> v8::StringObject::New(Handle<String> value) {
5620 i::Isolate* isolate = i::Isolate::Current(); 5622 i::Isolate* isolate = i::Isolate::Current();
5621 EnsureInitializedForIsolate(isolate, "v8::StringObject::New()"); 5623 EnsureInitializedForIsolate(isolate, "v8::StringObject::New()");
5622 LOG_API(isolate, "StringObject::New"); 5624 LOG_API(isolate, "StringObject::New");
5623 ENTER_V8(isolate); 5625 ENTER_V8(isolate);
5624 i::Handle<i::Object> obj = 5626 i::Handle<i::Object> obj = i::Object::ToObject(
5625 isolate->factory()->ToObject(Utils::OpenHandle(*value)); 5627 isolate, Utils::OpenHandle(*value)).ToHandleChecked();
5626 return Utils::ToLocal(obj); 5628 return Utils::ToLocal(obj);
5627 } 5629 }
5628 5630
5629 5631
5630 Local<v8::String> v8::StringObject::ValueOf() const { 5632 Local<v8::String> v8::StringObject::ValueOf() const {
5631 i::Isolate* isolate = i::Isolate::Current(); 5633 i::Isolate* isolate = i::Isolate::Current();
5632 LOG_API(isolate, "StringObject::StringValue"); 5634 LOG_API(isolate, "StringObject::StringValue");
5633 i::Handle<i::Object> obj = Utils::OpenHandle(this); 5635 i::Handle<i::Object> obj = Utils::OpenHandle(this);
5634 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); 5636 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj);
5635 return Utils::ToLocal( 5637 return Utils::ToLocal(
5636 i::Handle<i::String>(i::String::cast(jsvalue->value()))); 5638 i::Handle<i::String>(i::String::cast(jsvalue->value())));
5637 } 5639 }
5638 5640
5639 5641
5640 Local<v8::Value> v8::SymbolObject::New(Isolate* isolate, Handle<Symbol> value) { 5642 Local<v8::Value> v8::SymbolObject::New(Isolate* isolate, Handle<Symbol> value) {
5641 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 5643 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
5642 EnsureInitializedForIsolate(i_isolate, "v8::SymbolObject::New()"); 5644 EnsureInitializedForIsolate(i_isolate, "v8::SymbolObject::New()");
5643 LOG_API(i_isolate, "SymbolObject::New"); 5645 LOG_API(i_isolate, "SymbolObject::New");
5644 ENTER_V8(i_isolate); 5646 ENTER_V8(i_isolate);
5645 i::Handle<i::Object> obj = 5647 i::Handle<i::Object> obj = i::Object::ToObject(
5646 i_isolate->factory()->ToObject(Utils::OpenHandle(*value)); 5648 i_isolate, Utils::OpenHandle(*value)).ToHandleChecked();
5647 return Utils::ToLocal(obj); 5649 return Utils::ToLocal(obj);
5648 } 5650 }
5649 5651
5650 5652
5651 Local<v8::Symbol> v8::SymbolObject::ValueOf() const { 5653 Local<v8::Symbol> v8::SymbolObject::ValueOf() const {
5652 i::Isolate* isolate = i::Isolate::Current(); 5654 i::Isolate* isolate = i::Isolate::Current();
5653 LOG_API(isolate, "SymbolObject::SymbolValue"); 5655 LOG_API(isolate, "SymbolObject::SymbolValue");
5654 i::Handle<i::Object> obj = Utils::OpenHandle(this); 5656 i::Handle<i::Object> obj = Utils::OpenHandle(this);
5655 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); 5657 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj);
5656 return Utils::ToLocal( 5658 return Utils::ToLocal(
(...skipping 1997 matching lines...) Expand 10 before | Expand all | Expand 10 after
7654 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7656 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7655 Address callback_address = 7657 Address callback_address =
7656 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7658 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7657 VMState<EXTERNAL> state(isolate); 7659 VMState<EXTERNAL> state(isolate);
7658 ExternalCallbackScope call_scope(isolate, callback_address); 7660 ExternalCallbackScope call_scope(isolate, callback_address);
7659 callback(info); 7661 callback(info);
7660 } 7662 }
7661 7663
7662 7664
7663 } } // namespace v8::internal 7665 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698