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

Side by Side Diff: src/api.cc

Issue 20992005: Prepare some ValueOf renamings. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added comments Created 7 years, 4 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 | « include/v8.h ('k') | test/cctest/test-api.cc » ('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 6065 matching lines...) Expand 10 before | Expand all | Expand 10 after
6076 i::Isolate* isolate = i::Isolate::Current(); 6076 i::Isolate* isolate = i::Isolate::Current();
6077 EnsureInitializedForIsolate(isolate, "v8::NumberObject::New()"); 6077 EnsureInitializedForIsolate(isolate, "v8::NumberObject::New()");
6078 LOG_API(isolate, "NumberObject::New"); 6078 LOG_API(isolate, "NumberObject::New");
6079 ENTER_V8(isolate); 6079 ENTER_V8(isolate);
6080 i::Handle<i::Object> number = isolate->factory()->NewNumber(value); 6080 i::Handle<i::Object> number = isolate->factory()->NewNumber(value);
6081 i::Handle<i::Object> obj = isolate->factory()->ToObject(number); 6081 i::Handle<i::Object> obj = isolate->factory()->ToObject(number);
6082 return Utils::ToLocal(obj); 6082 return Utils::ToLocal(obj);
6083 } 6083 }
6084 6084
6085 6085
6086 double v8::NumberObject::NumberValue() const { 6086 double v8::NumberObject::ValueOf() const {
6087 i::Isolate* isolate = i::Isolate::Current(); 6087 i::Isolate* isolate = i::Isolate::Current();
6088 if (IsDeadCheck(isolate, "v8::NumberObject::NumberValue()")) return 0; 6088 if (IsDeadCheck(isolate, "v8::NumberObject::NumberValue()")) return 0;
6089 LOG_API(isolate, "NumberObject::NumberValue"); 6089 LOG_API(isolate, "NumberObject::NumberValue");
6090 i::Handle<i::Object> obj = Utils::OpenHandle(this); 6090 i::Handle<i::Object> obj = Utils::OpenHandle(this);
6091 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); 6091 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj);
6092 return jsvalue->value()->Number(); 6092 return jsvalue->value()->Number();
6093 } 6093 }
6094 6094
6095 6095
6096 Local<v8::Value> v8::BooleanObject::New(bool value) { 6096 Local<v8::Value> v8::BooleanObject::New(bool value) {
6097 i::Isolate* isolate = i::Isolate::Current(); 6097 i::Isolate* isolate = i::Isolate::Current();
6098 EnsureInitializedForIsolate(isolate, "v8::BooleanObject::New()"); 6098 EnsureInitializedForIsolate(isolate, "v8::BooleanObject::New()");
6099 LOG_API(isolate, "BooleanObject::New"); 6099 LOG_API(isolate, "BooleanObject::New");
6100 ENTER_V8(isolate); 6100 ENTER_V8(isolate);
6101 i::Handle<i::Object> boolean(value 6101 i::Handle<i::Object> boolean(value
6102 ? isolate->heap()->true_value() 6102 ? isolate->heap()->true_value()
6103 : isolate->heap()->false_value(), 6103 : isolate->heap()->false_value(),
6104 isolate); 6104 isolate);
6105 i::Handle<i::Object> obj = isolate->factory()->ToObject(boolean); 6105 i::Handle<i::Object> obj = isolate->factory()->ToObject(boolean);
6106 return Utils::ToLocal(obj); 6106 return Utils::ToLocal(obj);
6107 } 6107 }
6108 6108
6109 6109
6110 bool v8::BooleanObject::BooleanValue() const { 6110 bool v8::BooleanObject::ValueOf() const {
6111 i::Isolate* isolate = i::Isolate::Current(); 6111 i::Isolate* isolate = i::Isolate::Current();
6112 if (IsDeadCheck(isolate, "v8::BooleanObject::BooleanValue()")) return 0; 6112 if (IsDeadCheck(isolate, "v8::BooleanObject::BooleanValue()")) return 0;
6113 LOG_API(isolate, "BooleanObject::BooleanValue"); 6113 LOG_API(isolate, "BooleanObject::BooleanValue");
6114 i::Handle<i::Object> obj = Utils::OpenHandle(this); 6114 i::Handle<i::Object> obj = Utils::OpenHandle(this);
6115 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); 6115 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj);
6116 return jsvalue->value()->IsTrue(); 6116 return jsvalue->value()->IsTrue();
6117 } 6117 }
6118 6118
6119 6119
6120 Local<v8::Value> v8::StringObject::New(Handle<String> value) { 6120 Local<v8::Value> v8::StringObject::New(Handle<String> value) {
6121 i::Isolate* isolate = i::Isolate::Current(); 6121 i::Isolate* isolate = i::Isolate::Current();
6122 EnsureInitializedForIsolate(isolate, "v8::StringObject::New()"); 6122 EnsureInitializedForIsolate(isolate, "v8::StringObject::New()");
6123 LOG_API(isolate, "StringObject::New"); 6123 LOG_API(isolate, "StringObject::New");
6124 ENTER_V8(isolate); 6124 ENTER_V8(isolate);
6125 i::Handle<i::Object> obj = 6125 i::Handle<i::Object> obj =
6126 isolate->factory()->ToObject(Utils::OpenHandle(*value)); 6126 isolate->factory()->ToObject(Utils::OpenHandle(*value));
6127 return Utils::ToLocal(obj); 6127 return Utils::ToLocal(obj);
6128 } 6128 }
6129 6129
6130 6130
6131 Local<v8::String> v8::StringObject::StringValue() const { 6131 Local<v8::String> v8::StringObject::ValueOf() const {
6132 i::Isolate* isolate = i::Isolate::Current(); 6132 i::Isolate* isolate = i::Isolate::Current();
6133 if (IsDeadCheck(isolate, "v8::StringObject::StringValue()")) { 6133 if (IsDeadCheck(isolate, "v8::StringObject::StringValue()")) {
6134 return Local<v8::String>(); 6134 return Local<v8::String>();
6135 } 6135 }
6136 LOG_API(isolate, "StringObject::StringValue"); 6136 LOG_API(isolate, "StringObject::StringValue");
6137 i::Handle<i::Object> obj = Utils::OpenHandle(this); 6137 i::Handle<i::Object> obj = Utils::OpenHandle(this);
6138 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); 6138 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj);
6139 return Utils::ToLocal( 6139 return Utils::ToLocal(
6140 i::Handle<i::String>(i::String::cast(jsvalue->value()))); 6140 i::Handle<i::String>(i::String::cast(jsvalue->value())));
6141 } 6141 }
6142 6142
6143 6143
6144 Local<v8::Value> v8::SymbolObject::New(Isolate* isolate, Handle<Symbol> value) { 6144 Local<v8::Value> v8::SymbolObject::New(Isolate* isolate, Handle<Symbol> value) {
6145 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 6145 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
6146 EnsureInitializedForIsolate(i_isolate, "v8::SymbolObject::New()"); 6146 EnsureInitializedForIsolate(i_isolate, "v8::SymbolObject::New()");
6147 LOG_API(i_isolate, "SymbolObject::New"); 6147 LOG_API(i_isolate, "SymbolObject::New");
6148 ENTER_V8(i_isolate); 6148 ENTER_V8(i_isolate);
6149 i::Handle<i::Object> obj = 6149 i::Handle<i::Object> obj =
6150 i_isolate->factory()->ToObject(Utils::OpenHandle(*value)); 6150 i_isolate->factory()->ToObject(Utils::OpenHandle(*value));
6151 return Utils::ToLocal(obj); 6151 return Utils::ToLocal(obj);
6152 } 6152 }
6153 6153
6154 6154
6155 Local<v8::Symbol> v8::SymbolObject::SymbolValue() const { 6155 Local<v8::Symbol> v8::SymbolObject::ValueOf() const {
6156 i::Isolate* isolate = i::Isolate::Current(); 6156 i::Isolate* isolate = i::Isolate::Current();
6157 if (IsDeadCheck(isolate, "v8::SymbolObject::SymbolValue()")) 6157 if (IsDeadCheck(isolate, "v8::SymbolObject::SymbolValue()"))
6158 return Local<v8::Symbol>(); 6158 return Local<v8::Symbol>();
6159 LOG_API(isolate, "SymbolObject::SymbolValue"); 6159 LOG_API(isolate, "SymbolObject::SymbolValue");
6160 i::Handle<i::Object> obj = Utils::OpenHandle(this); 6160 i::Handle<i::Object> obj = Utils::OpenHandle(this);
6161 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); 6161 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj);
6162 return Utils::ToLocal( 6162 return Utils::ToLocal(
6163 i::Handle<i::Symbol>(i::Symbol::cast(jsvalue->value()))); 6163 i::Handle<i::Symbol>(i::Symbol::cast(jsvalue->value())));
6164 } 6164 }
6165 6165
6166 6166
6167 Local<v8::Value> v8::Date::New(double time) { 6167 Local<v8::Value> v8::Date::New(double time) {
6168 i::Isolate* isolate = i::Isolate::Current(); 6168 i::Isolate* isolate = i::Isolate::Current();
6169 EnsureInitializedForIsolate(isolate, "v8::Date::New()"); 6169 EnsureInitializedForIsolate(isolate, "v8::Date::New()");
6170 LOG_API(isolate, "Date::New"); 6170 LOG_API(isolate, "Date::New");
6171 if (std::isnan(time)) { 6171 if (std::isnan(time)) {
6172 // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. 6172 // Introduce only canonical NaN value into the VM, to avoid signaling NaNs.
6173 time = i::OS::nan_value(); 6173 time = i::OS::nan_value();
6174 } 6174 }
6175 ENTER_V8(isolate); 6175 ENTER_V8(isolate);
6176 EXCEPTION_PREAMBLE(isolate); 6176 EXCEPTION_PREAMBLE(isolate);
6177 i::Handle<i::Object> obj = 6177 i::Handle<i::Object> obj =
6178 i::Execution::NewDate(time, &has_pending_exception); 6178 i::Execution::NewDate(time, &has_pending_exception);
6179 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Value>()); 6179 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Value>());
6180 return Utils::ToLocal(obj); 6180 return Utils::ToLocal(obj);
6181 } 6181 }
6182 6182
6183 6183
6184 double v8::Date::NumberValue() const { 6184 double v8::Date::ValueOf() const {
6185 i::Isolate* isolate = i::Isolate::Current(); 6185 i::Isolate* isolate = i::Isolate::Current();
6186 if (IsDeadCheck(isolate, "v8::Date::NumberValue()")) return 0; 6186 if (IsDeadCheck(isolate, "v8::Date::NumberValue()")) return 0;
6187 LOG_API(isolate, "Date::NumberValue"); 6187 LOG_API(isolate, "Date::NumberValue");
6188 i::Handle<i::Object> obj = Utils::OpenHandle(this); 6188 i::Handle<i::Object> obj = Utils::OpenHandle(this);
6189 i::Handle<i::JSDate> jsdate = i::Handle<i::JSDate>::cast(obj); 6189 i::Handle<i::JSDate> jsdate = i::Handle<i::JSDate>::cast(obj);
6190 return jsdate->value()->Number(); 6190 return jsdate->value()->Number();
6191 } 6191 }
6192 6192
6193 6193
6194 void v8::Date::DateTimeConfigurationChangeNotification() { 6194 void v8::Date::DateTimeConfigurationChangeNotification() {
(...skipping 1902 matching lines...) Expand 10 before | Expand all | Expand 10 after
8097 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 8097 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
8098 Address callback_address = 8098 Address callback_address =
8099 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8099 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8100 VMState<EXTERNAL> state(isolate); 8100 VMState<EXTERNAL> state(isolate);
8101 ExternalCallbackScope call_scope(isolate, callback_address); 8101 ExternalCallbackScope call_scope(isolate, callback_address);
8102 return callback(info); 8102 return callback(info);
8103 } 8103 }
8104 8104
8105 8105
8106 } } // namespace v8::internal 8106 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698