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

Side by Side Diff: src/api.cc

Issue 231103002: Object::GetElements() and friends maybehandlification. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: FixedArray::UnionOfKeys() maybehandlified 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/bootstrapper.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 2206 matching lines...) Expand 10 before | Expand all | Expand 10 after
2217 } 2217 }
2218 2218
2219 2219
2220 // --- S t a c k F r a m e --- 2220 // --- S t a c k F r a m e ---
2221 2221
2222 int StackFrame::GetLineNumber() const { 2222 int StackFrame::GetLineNumber() const {
2223 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2223 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2224 ENTER_V8(isolate); 2224 ENTER_V8(isolate);
2225 i::HandleScope scope(isolate); 2225 i::HandleScope scope(isolate);
2226 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2226 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2227 i::Handle<i::Object> line = GetProperty(self, "lineNumber"); 2227 i::Handle<i::Object> line = GetProperty(self, "lineNumber").ToHandleChecked();
2228 if (!line->IsSmi()) { 2228 if (!line->IsSmi()) {
2229 return Message::kNoLineNumberInfo; 2229 return Message::kNoLineNumberInfo;
2230 } 2230 }
2231 return i::Smi::cast(*line)->value(); 2231 return i::Smi::cast(*line)->value();
2232 } 2232 }
2233 2233
2234 2234
2235 int StackFrame::GetColumn() const { 2235 int StackFrame::GetColumn() const {
2236 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2236 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2237 ENTER_V8(isolate); 2237 ENTER_V8(isolate);
2238 i::HandleScope scope(isolate); 2238 i::HandleScope scope(isolate);
2239 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2239 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2240 i::Handle<i::Object> column = GetProperty(self, "column"); 2240 i::Handle<i::Object> column = GetProperty(self, "column").ToHandleChecked();
2241 if (!column->IsSmi()) { 2241 if (!column->IsSmi()) {
2242 return Message::kNoColumnInfo; 2242 return Message::kNoColumnInfo;
2243 } 2243 }
2244 return i::Smi::cast(*column)->value(); 2244 return i::Smi::cast(*column)->value();
2245 } 2245 }
2246 2246
2247 2247
2248 int StackFrame::GetScriptId() const { 2248 int StackFrame::GetScriptId() const {
2249 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2249 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2250 ENTER_V8(isolate); 2250 ENTER_V8(isolate);
2251 i::HandleScope scope(isolate); 2251 i::HandleScope scope(isolate);
2252 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2252 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2253 i::Handle<i::Object> scriptId = GetProperty(self, "scriptId"); 2253 i::Handle<i::Object> scriptId =
2254 GetProperty(self, "scriptId").ToHandleChecked();
2254 if (!scriptId->IsSmi()) { 2255 if (!scriptId->IsSmi()) {
2255 return Message::kNoScriptIdInfo; 2256 return Message::kNoScriptIdInfo;
2256 } 2257 }
2257 return i::Smi::cast(*scriptId)->value(); 2258 return i::Smi::cast(*scriptId)->value();
2258 } 2259 }
2259 2260
2260 2261
2261 Local<String> StackFrame::GetScriptName() const { 2262 Local<String> StackFrame::GetScriptName() const {
2262 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2263 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2263 ENTER_V8(isolate); 2264 ENTER_V8(isolate);
2264 EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate)); 2265 EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
2265 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2266 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2266 i::Handle<i::Object> name = GetProperty(self, "scriptName"); 2267 i::Handle<i::Object> name = GetProperty(self, "scriptName").ToHandleChecked();
2267 if (!name->IsString()) { 2268 if (!name->IsString()) {
2268 return Local<String>(); 2269 return Local<String>();
2269 } 2270 }
2270 return scope.Escape(Local<String>::Cast(Utils::ToLocal(name))); 2271 return scope.Escape(Local<String>::Cast(Utils::ToLocal(name)));
2271 } 2272 }
2272 2273
2273 2274
2274 Local<String> StackFrame::GetScriptNameOrSourceURL() const { 2275 Local<String> StackFrame::GetScriptNameOrSourceURL() const {
2275 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2276 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2276 ENTER_V8(isolate); 2277 ENTER_V8(isolate);
2277 EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate)); 2278 EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
2278 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2279 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2279 i::Handle<i::Object> name = GetProperty(self, "scriptNameOrSourceURL"); 2280 i::Handle<i::Object> name =
2281 GetProperty(self, "scriptNameOrSourceURL").ToHandleChecked();
2280 if (!name->IsString()) { 2282 if (!name->IsString()) {
2281 return Local<String>(); 2283 return Local<String>();
2282 } 2284 }
2283 return scope.Escape(Local<String>::Cast(Utils::ToLocal(name))); 2285 return scope.Escape(Local<String>::Cast(Utils::ToLocal(name)));
2284 } 2286 }
2285 2287
2286 2288
2287 Local<String> StackFrame::GetFunctionName() const { 2289 Local<String> StackFrame::GetFunctionName() const {
2288 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2290 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2289 ENTER_V8(isolate); 2291 ENTER_V8(isolate);
2290 EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate)); 2292 EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
2291 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2293 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2292 i::Handle<i::Object> name = GetProperty(self, "functionName"); 2294 i::Handle<i::Object> name =
2295 GetProperty(self, "functionName").ToHandleChecked();
2293 if (!name->IsString()) { 2296 if (!name->IsString()) {
2294 return Local<String>(); 2297 return Local<String>();
2295 } 2298 }
2296 return scope.Escape(Local<String>::Cast(Utils::ToLocal(name))); 2299 return scope.Escape(Local<String>::Cast(Utils::ToLocal(name)));
2297 } 2300 }
2298 2301
2299 2302
2300 bool StackFrame::IsEval() const { 2303 bool StackFrame::IsEval() const {
2301 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2304 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2302 ENTER_V8(isolate); 2305 ENTER_V8(isolate);
2303 i::HandleScope scope(isolate); 2306 i::HandleScope scope(isolate);
2304 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2307 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2305 i::Handle<i::Object> is_eval = GetProperty(self, "isEval"); 2308 i::Handle<i::Object> is_eval = GetProperty(self, "isEval").ToHandleChecked();
2306 return is_eval->IsTrue(); 2309 return is_eval->IsTrue();
2307 } 2310 }
2308 2311
2309 2312
2310 bool StackFrame::IsConstructor() const { 2313 bool StackFrame::IsConstructor() const {
2311 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2314 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2312 ENTER_V8(isolate); 2315 ENTER_V8(isolate);
2313 i::HandleScope scope(isolate); 2316 i::HandleScope scope(isolate);
2314 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2317 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2315 i::Handle<i::Object> is_constructor = GetProperty(self, "isConstructor"); 2318 i::Handle<i::Object> is_constructor =
2319 GetProperty(self, "isConstructor").ToHandleChecked();
2316 return is_constructor->IsTrue(); 2320 return is_constructor->IsTrue();
2317 } 2321 }
2318 2322
2319 2323
2320 // --- J S O N --- 2324 // --- J S O N ---
2321 2325
2322 Local<Value> JSON::Parse(Local<String> json_string) { 2326 Local<Value> JSON::Parse(Local<String> json_string) {
2323 i::Isolate* isolate = i::Isolate::Current(); 2327 i::Isolate* isolate = i::Isolate::Current();
2324 EnsureInitializedForIsolate(isolate, "v8::JSON::Parse"); 2328 EnsureInitializedForIsolate(isolate, "v8::JSON::Parse");
2325 ENTER_V8(isolate); 2329 ENTER_V8(isolate);
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
3140 } 3144 }
3141 3145
3142 3146
3143 Local<Value> v8::Object::Get(v8::Handle<Value> key) { 3147 Local<Value> v8::Object::Get(v8::Handle<Value> key) {
3144 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3148 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3145 ON_BAILOUT(isolate, "v8::Object::Get()", return Local<v8::Value>()); 3149 ON_BAILOUT(isolate, "v8::Object::Get()", return Local<v8::Value>());
3146 ENTER_V8(isolate); 3150 ENTER_V8(isolate);
3147 i::Handle<i::Object> self = Utils::OpenHandle(this); 3151 i::Handle<i::Object> self = Utils::OpenHandle(this);
3148 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); 3152 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
3149 EXCEPTION_PREAMBLE(isolate); 3153 EXCEPTION_PREAMBLE(isolate);
3150 i::Handle<i::Object> result = 3154 i::Handle<i::Object> result;
3151 i::Runtime::GetObjectProperty(isolate, self, key_obj); 3155 has_pending_exception =
3152 has_pending_exception = result.is_null(); 3156 !i::Runtime::GetObjectProperty(isolate, self, key_obj).ToHandle(&result);
3153 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); 3157 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
3154 return Utils::ToLocal(result); 3158 return Utils::ToLocal(result);
3155 } 3159 }
3156 3160
3157 3161
3158 Local<Value> v8::Object::Get(uint32_t index) { 3162 Local<Value> v8::Object::Get(uint32_t index) {
3159 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3163 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3160 ON_BAILOUT(isolate, "v8::Object::Get()", return Local<v8::Value>()); 3164 ON_BAILOUT(isolate, "v8::Object::Get()", return Local<v8::Value>());
3161 ENTER_V8(isolate); 3165 ENTER_V8(isolate);
3162 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3166 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3163 EXCEPTION_PREAMBLE(isolate); 3167 EXCEPTION_PREAMBLE(isolate);
3164 i::Handle<i::Object> result = i::Object::GetElement(isolate, self, index); 3168 i::Handle<i::Object> result;
3165 has_pending_exception = result.is_null(); 3169 has_pending_exception =
3170 !i::Object::GetElement(isolate, self, index).ToHandle(&result);
3166 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); 3171 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
3167 return Utils::ToLocal(result); 3172 return Utils::ToLocal(result);
3168 } 3173 }
3169 3174
3170 3175
3171 Local<Value> v8::Object::GetPrivate(v8::Handle<Private> key) { 3176 Local<Value> v8::Object::GetPrivate(v8::Handle<Private> key) {
3172 return Get(v8::Handle<Value>(reinterpret_cast<Value*>(*key))); 3177 return Get(v8::Handle<Value>(reinterpret_cast<Value*>(*key)));
3173 } 3178 }
3174 3179
3175 3180
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
3240 } 3245 }
3241 3246
3242 3247
3243 Local<Array> v8::Object::GetPropertyNames() { 3248 Local<Array> v8::Object::GetPropertyNames() {
3244 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3249 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3245 ON_BAILOUT(isolate, "v8::Object::GetPropertyNames()", 3250 ON_BAILOUT(isolate, "v8::Object::GetPropertyNames()",
3246 return Local<v8::Array>()); 3251 return Local<v8::Array>());
3247 ENTER_V8(isolate); 3252 ENTER_V8(isolate);
3248 i::HandleScope scope(isolate); 3253 i::HandleScope scope(isolate);
3249 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3254 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3250 bool threw = false; 3255 EXCEPTION_PREAMBLE(isolate);
3251 i::Handle<i::FixedArray> value = 3256 i::Handle<i::FixedArray> value;
3252 i::GetKeysInFixedArrayFor(self, i::INCLUDE_PROTOS, &threw); 3257 has_pending_exception =
3253 if (threw) return Local<v8::Array>(); 3258 !i::GetKeysInFixedArrayFor(self, i::INCLUDE_PROTOS).ToHandle(&value);
3259 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Array>());
3254 // Because we use caching to speed up enumeration it is important 3260 // Because we use caching to speed up enumeration it is important
3255 // to never change the result of the basic enumeration function so 3261 // to never change the result of the basic enumeration function so
3256 // we clone the result. 3262 // we clone the result.
3257 i::Handle<i::FixedArray> elms = isolate->factory()->CopyFixedArray(value); 3263 i::Handle<i::FixedArray> elms = isolate->factory()->CopyFixedArray(value);
3258 i::Handle<i::JSArray> result = 3264 i::Handle<i::JSArray> result =
3259 isolate->factory()->NewJSArrayWithElements(elms); 3265 isolate->factory()->NewJSArrayWithElements(elms);
3260 return Utils::ToLocal(scope.CloseAndEscape(result)); 3266 return Utils::ToLocal(scope.CloseAndEscape(result));
3261 } 3267 }
3262 3268
3263 3269
3264 Local<Array> v8::Object::GetOwnPropertyNames() { 3270 Local<Array> v8::Object::GetOwnPropertyNames() {
3265 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3271 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3266 ON_BAILOUT(isolate, "v8::Object::GetOwnPropertyNames()", 3272 ON_BAILOUT(isolate, "v8::Object::GetOwnPropertyNames()",
3267 return Local<v8::Array>()); 3273 return Local<v8::Array>());
3268 ENTER_V8(isolate); 3274 ENTER_V8(isolate);
3269 i::HandleScope scope(isolate); 3275 i::HandleScope scope(isolate);
3270 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3276 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3271 bool threw = false; 3277 EXCEPTION_PREAMBLE(isolate);
3272 i::Handle<i::FixedArray> value = 3278 i::Handle<i::FixedArray> value;
3273 i::GetKeysInFixedArrayFor(self, i::LOCAL_ONLY, &threw); 3279 has_pending_exception =
3274 if (threw) return Local<v8::Array>(); 3280 !i::GetKeysInFixedArrayFor(self, i::LOCAL_ONLY).ToHandle(&value);
3281 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Array>());
3275 // Because we use caching to speed up enumeration it is important 3282 // Because we use caching to speed up enumeration it is important
3276 // to never change the result of the basic enumeration function so 3283 // to never change the result of the basic enumeration function so
3277 // we clone the result. 3284 // we clone the result.
3278 i::Handle<i::FixedArray> elms = isolate->factory()->CopyFixedArray(value); 3285 i::Handle<i::FixedArray> elms = isolate->factory()->CopyFixedArray(value);
3279 i::Handle<i::JSArray> result = 3286 i::Handle<i::JSArray> result =
3280 isolate->factory()->NewJSArrayWithElements(elms); 3287 isolate->factory()->NewJSArrayWithElements(elms);
3281 return Utils::ToLocal(scope.CloseAndEscape(result)); 3288 return Utils::ToLocal(scope.CloseAndEscape(result));
3282 } 3289 }
3283 3290
3284 3291
(...skipping 2877 matching lines...) Expand 10 before | Expand all | Expand 10 after
6162 } 6169 }
6163 6170
6164 6171
6165 Local<Symbol> v8::Symbol::For(Isolate* isolate, Local<String> name) { 6172 Local<Symbol> v8::Symbol::For(Isolate* isolate, Local<String> name) {
6166 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 6173 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
6167 i::Handle<i::String> i_name = Utils::OpenHandle(*name); 6174 i::Handle<i::String> i_name = Utils::OpenHandle(*name);
6168 i::Handle<i::JSObject> registry = i_isolate->GetSymbolRegistry(); 6175 i::Handle<i::JSObject> registry = i_isolate->GetSymbolRegistry();
6169 i::Handle<i::String> part = i_isolate->factory()->for_string(); 6176 i::Handle<i::String> part = i_isolate->factory()->for_string();
6170 i::Handle<i::JSObject> symbols = 6177 i::Handle<i::JSObject> symbols =
6171 i::Handle<i::JSObject>::cast( 6178 i::Handle<i::JSObject>::cast(
6172 i::Object::GetPropertyOrElement(registry, part)); 6179 i::Object::GetPropertyOrElement(registry, part).ToHandleChecked());
6173 i::Handle<i::Object> symbol = 6180 i::Handle<i::Object> symbol =
6174 i::Object::GetPropertyOrElement(symbols, i_name); 6181 i::Object::GetPropertyOrElement(symbols, i_name).ToHandleChecked();
6175 if (!symbol->IsSymbol()) { 6182 if (!symbol->IsSymbol()) {
6176 ASSERT(symbol->IsUndefined()); 6183 ASSERT(symbol->IsUndefined());
6177 symbol = i_isolate->factory()->NewSymbol(); 6184 symbol = i_isolate->factory()->NewSymbol();
6178 i::Handle<i::Symbol>::cast(symbol)->set_name(*i_name); 6185 i::Handle<i::Symbol>::cast(symbol)->set_name(*i_name);
6179 i::JSObject::SetProperty( 6186 i::JSObject::SetProperty(
6180 symbols, i_name, symbol, NONE, i::STRICT).Assert(); 6187 symbols, i_name, symbol, NONE, i::STRICT).Assert();
6181 } 6188 }
6182 return Utils::ToLocal(i::Handle<i::Symbol>::cast(symbol)); 6189 return Utils::ToLocal(i::Handle<i::Symbol>::cast(symbol));
6183 } 6190 }
6184 6191
6185 6192
6186 Local<Symbol> v8::Symbol::ForApi(Isolate* isolate, Local<String> name) { 6193 Local<Symbol> v8::Symbol::ForApi(Isolate* isolate, Local<String> name) {
6187 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 6194 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
6188 i::Handle<i::String> i_name = Utils::OpenHandle(*name); 6195 i::Handle<i::String> i_name = Utils::OpenHandle(*name);
6189 i::Handle<i::JSObject> registry = i_isolate->GetSymbolRegistry(); 6196 i::Handle<i::JSObject> registry = i_isolate->GetSymbolRegistry();
6190 i::Handle<i::String> part = i_isolate->factory()->for_api_string(); 6197 i::Handle<i::String> part = i_isolate->factory()->for_api_string();
6191 i::Handle<i::JSObject> symbols = 6198 i::Handle<i::JSObject> symbols =
6192 i::Handle<i::JSObject>::cast( 6199 i::Handle<i::JSObject>::cast(
6193 i::Object::GetPropertyOrElement(registry, part)); 6200 i::Object::GetPropertyOrElement(registry, part).ToHandleChecked());
6194 i::Handle<i::Object> symbol = 6201 i::Handle<i::Object> symbol =
6195 i::Object::GetPropertyOrElement(symbols, i_name); 6202 i::Object::GetPropertyOrElement(symbols, i_name).ToHandleChecked();
6196 if (!symbol->IsSymbol()) { 6203 if (!symbol->IsSymbol()) {
6197 ASSERT(symbol->IsUndefined()); 6204 ASSERT(symbol->IsUndefined());
6198 symbol = i_isolate->factory()->NewSymbol(); 6205 symbol = i_isolate->factory()->NewSymbol();
6199 i::Handle<i::Symbol>::cast(symbol)->set_name(*i_name); 6206 i::Handle<i::Symbol>::cast(symbol)->set_name(*i_name);
6200 i::JSObject::SetProperty( 6207 i::JSObject::SetProperty(
6201 symbols, i_name, symbol, NONE, i::STRICT).Assert(); 6208 symbols, i_name, symbol, NONE, i::STRICT).Assert();
6202 } 6209 }
6203 return Utils::ToLocal(i::Handle<i::Symbol>::cast(symbol)); 6210 return Utils::ToLocal(i::Handle<i::Symbol>::cast(symbol));
6204 } 6211 }
6205 6212
(...skipping 10 matching lines...) Expand all
6216 } 6223 }
6217 6224
6218 6225
6219 Local<Private> v8::Private::ForApi(Isolate* isolate, Local<String> name) { 6226 Local<Private> v8::Private::ForApi(Isolate* isolate, Local<String> name) {
6220 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 6227 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
6221 i::Handle<i::String> i_name = Utils::OpenHandle(*name); 6228 i::Handle<i::String> i_name = Utils::OpenHandle(*name);
6222 i::Handle<i::JSObject> registry = i_isolate->GetSymbolRegistry(); 6229 i::Handle<i::JSObject> registry = i_isolate->GetSymbolRegistry();
6223 i::Handle<i::String> part = i_isolate->factory()->private_api_string(); 6230 i::Handle<i::String> part = i_isolate->factory()->private_api_string();
6224 i::Handle<i::JSObject> privates = 6231 i::Handle<i::JSObject> privates =
6225 i::Handle<i::JSObject>::cast( 6232 i::Handle<i::JSObject>::cast(
6226 i::Object::GetPropertyOrElement(registry, part)); 6233 i::Object::GetPropertyOrElement(registry, part).ToHandleChecked());
6227 i::Handle<i::Object> symbol = 6234 i::Handle<i::Object> symbol =
6228 i::Object::GetPropertyOrElement(privates, i_name); 6235 i::Object::GetPropertyOrElement(privates, i_name).ToHandleChecked();
6229 if (!symbol->IsSymbol()) { 6236 if (!symbol->IsSymbol()) {
6230 ASSERT(symbol->IsUndefined()); 6237 ASSERT(symbol->IsUndefined());
6231 symbol = i_isolate->factory()->NewPrivateSymbol(); 6238 symbol = i_isolate->factory()->NewPrivateSymbol();
6232 i::Handle<i::Symbol>::cast(symbol)->set_name(*i_name); 6239 i::Handle<i::Symbol>::cast(symbol)->set_name(*i_name);
6233 i::JSObject::SetProperty( 6240 i::JSObject::SetProperty(
6234 privates, i_name, symbol, NONE, i::STRICT).Assert(); 6241 privates, i_name, symbol, NONE, i::STRICT).Assert();
6235 } 6242 }
6236 Local<Symbol> result = Utils::ToLocal(i::Handle<i::Symbol>::cast(symbol)); 6243 Local<Symbol> result = Utils::ToLocal(i::Handle<i::Symbol>::cast(symbol));
6237 return v8::Handle<Private>(reinterpret_cast<Private*>(*result)); 6244 return v8::Handle<Private>(reinterpret_cast<Private*>(*result));
6238 } 6245 }
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
7684 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7691 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7685 Address callback_address = 7692 Address callback_address =
7686 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7693 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7687 VMState<EXTERNAL> state(isolate); 7694 VMState<EXTERNAL> state(isolate);
7688 ExternalCallbackScope call_scope(isolate, callback_address); 7695 ExternalCallbackScope call_scope(isolate, callback_address);
7689 callback(info); 7696 callback(info);
7690 } 7697 }
7691 7698
7692 7699
7693 } } // namespace v8::internal 7700 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698