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

Side by Side Diff: src/bootstrapper.cc

Issue 1517673002: Fix Object.prototype.toString.call(proxy) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add test Created 5 years 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
OLDNEW
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/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/extensions/externalize-string-extension.h" 10 #include "src/extensions/externalize-string-extension.h"
(...skipping 2222 matching lines...) Expand 10 before | Expand all | Expand 10 after
2233 proxy_function_map->set_is_constructor(true); 2233 proxy_function_map->set_is_constructor(true);
2234 native_context()->set_proxy_function_map(*proxy_function_map); 2234 native_context()->set_proxy_function_map(*proxy_function_map);
2235 2235
2236 Handle<Map> proxy_map = 2236 Handle<Map> proxy_map =
2237 factory()->NewMap(JS_PROXY_TYPE, JSProxy::kSize, FAST_ELEMENTS); 2237 factory()->NewMap(JS_PROXY_TYPE, JSProxy::kSize, FAST_ELEMENTS);
2238 native_context()->set_proxy_map(*proxy_map); 2238 native_context()->set_proxy_map(*proxy_map);
2239 2239
2240 Handle<Map> proxy_callable_map = Map::Copy(proxy_map, "callable Proxy"); 2240 Handle<Map> proxy_callable_map = Map::Copy(proxy_map, "callable Proxy");
2241 proxy_callable_map->set_is_callable(); 2241 proxy_callable_map->set_is_callable();
2242 native_context()->set_proxy_callable_map(*proxy_callable_map); 2242 native_context()->set_proxy_callable_map(*proxy_callable_map);
2243 proxy_callable_map->SetConstructor(native_context()->function_function());
2243 2244
2244 Handle<Map> proxy_constructor_map = 2245 Handle<Map> proxy_constructor_map =
2245 Map::Copy(proxy_callable_map, "constructor Proxy"); 2246 Map::Copy(proxy_callable_map, "constructor Proxy");
2246 proxy_constructor_map->set_is_constructor(true); 2247 proxy_constructor_map->set_is_constructor(true);
2247 native_context()->set_proxy_constructor_map(*proxy_constructor_map); 2248 native_context()->set_proxy_constructor_map(*proxy_constructor_map);
2248 } 2249 }
2249 2250
2250 2251
2251 void Genesis::InitializeGlobal_harmony_proxies() { 2252 void Genesis::InitializeGlobal_harmony_proxies() {
2252 if (!FLAG_harmony_proxies) return; 2253 if (!FLAG_harmony_proxies) return;
2253 Handle<JSGlobalObject> global( 2254 Handle<JSGlobalObject> global(
2254 JSGlobalObject::cast(native_context()->global_object())); 2255 JSGlobalObject::cast(native_context()->global_object()));
2255 Isolate* isolate = global->GetIsolate(); 2256 Isolate* isolate = global->GetIsolate();
2256 Factory* factory = isolate->factory(); 2257 Factory* factory = isolate->factory();
2257 2258
2258 InstallJSProxyMaps(); 2259 InstallJSProxyMaps();
2259 2260
2260 // Create the Proxy object. 2261 // Create the Proxy object.
2261 Handle<String> name = factory->Proxy_string(); 2262 Handle<String> name = factory->Proxy_string();
2262 Handle<Code> code(isolate->builtins()->ProxyConstructor()); 2263 Handle<Code> code(isolate->builtins()->ProxyConstructor());
2263 2264
2264 Handle<JSFunction> proxy_function = 2265 Handle<JSFunction> proxy_function = factory->NewFunction(
2265 factory->NewFunction(isolate->proxy_function_map(), name, code); 2266 isolate->proxy_function_map(), factory->Object_string(), code);
2266 2267
2267 JSFunction::SetInitialMap(proxy_function, 2268 JSFunction::SetInitialMap(proxy_function,
2268 Handle<Map>(native_context()->proxy_map(), isolate), 2269 Handle<Map>(native_context()->proxy_map(), isolate),
2269 factory->null_value()); 2270 factory->null_value());
2270 2271
2271 proxy_function->shared()->set_construct_stub( 2272 proxy_function->shared()->set_construct_stub(
2272 *isolate->builtins()->ProxyConstructor_ConstructStub()); 2273 *isolate->builtins()->ProxyConstructor_ConstructStub());
2273 proxy_function->shared()->set_internal_formal_parameter_count(2); 2274 proxy_function->shared()->set_internal_formal_parameter_count(2);
2274 proxy_function->shared()->set_length(2); 2275 proxy_function->shared()->set_length(2);
2275 2276
2276 native_context()->set_proxy_function(*proxy_function); 2277 native_context()->set_proxy_function(*proxy_function);
2277 InstallFunction(global, name, proxy_function, name); 2278 InstallFunction(global, name, proxy_function, factory->Object_string());
2278 } 2279 }
2279 2280
2280 2281
2281 Handle<JSFunction> Genesis::InstallInternalArray(Handle<JSObject> target, 2282 Handle<JSFunction> Genesis::InstallInternalArray(Handle<JSObject> target,
2282 const char* name, 2283 const char* name,
2283 ElementsKind elements_kind) { 2284 ElementsKind elements_kind) {
2284 // --- I n t e r n a l A r r a y --- 2285 // --- I n t e r n a l A r r a y ---
2285 // An array constructor on the builtins object that works like 2286 // An array constructor on the builtins object that works like
2286 // the public Array constructor, except that its prototype 2287 // the public Array constructor, except that its prototype
2287 // doesn't inherit from Object.prototype. 2288 // doesn't inherit from Object.prototype.
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after
3304 } 3305 }
3305 3306
3306 3307
3307 // Called when the top-level V8 mutex is destroyed. 3308 // Called when the top-level V8 mutex is destroyed.
3308 void Bootstrapper::FreeThreadResources() { 3309 void Bootstrapper::FreeThreadResources() {
3309 DCHECK(!IsActive()); 3310 DCHECK(!IsActive());
3310 } 3311 }
3311 3312
3312 } // namespace internal 3313 } // namespace internal
3313 } // namespace v8 3314 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698