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

Side by Side Diff: src/factory.cc

Issue 886473005: Add WeakMap to v8.h (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Moved constructor&destructor to api.cc Created 5 years, 10 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
« no previous file with comments | « src/factory.h ('k') | src/runtime/runtime.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 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/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/conversions.h" 9 #include "src/conversions.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 2218 matching lines...) Expand 10 before | Expand all | Expand 10 after
2229 Handle<JSObject> result = NewJSObjectFromMap(map); 2229 Handle<JSObject> result = NewJSObjectFromMap(map);
2230 Handle<Smi> value(Smi::FromInt(length), isolate()); 2230 Handle<Smi> value(Smi::FromInt(length), isolate());
2231 Object::SetProperty(result, length_string(), value, STRICT).Assert(); 2231 Object::SetProperty(result, length_string(), value, STRICT).Assert();
2232 if (!strict_mode_callee) { 2232 if (!strict_mode_callee) {
2233 Object::SetProperty(result, callee_string(), callee, STRICT).Assert(); 2233 Object::SetProperty(result, callee_string(), callee, STRICT).Assert();
2234 } 2234 }
2235 return result; 2235 return result;
2236 } 2236 }
2237 2237
2238 2238
2239 Handle<JSWeakMap> Factory::NewJSWeakMap() {
2240 // TODO(adamk): Currently the map is only created three times per
2241 // isolate. If it's created more often, the map should be moved into the
2242 // strong root list.
2243 Handle<Map> map = NewMap(JS_WEAK_MAP_TYPE, JSWeakMap::kSize);
2244 return Handle<JSWeakMap>::cast(NewJSObjectFromMap(map));
2245 }
2246
2247
2239 Handle<JSFunction> Factory::CreateApiFunction( 2248 Handle<JSFunction> Factory::CreateApiFunction(
2240 Handle<FunctionTemplateInfo> obj, 2249 Handle<FunctionTemplateInfo> obj,
2241 Handle<Object> prototype, 2250 Handle<Object> prototype,
2242 ApiInstanceType instance_type) { 2251 ApiInstanceType instance_type) {
2243 Handle<Code> code = isolate()->builtins()->HandleApiCall(); 2252 Handle<Code> code = isolate()->builtins()->HandleApiCall();
2244 Handle<Code> construct_stub = isolate()->builtins()->JSConstructStubApi(); 2253 Handle<Code> construct_stub = isolate()->builtins()->JSConstructStubApi();
2245 2254
2246 obj->set_instantiated(true); 2255 obj->set_instantiated(true);
2247 Handle<JSFunction> result; 2256 Handle<JSFunction> result;
2248 if (obj->remove_prototype()) { 2257 if (obj->remove_prototype()) {
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
2514 return Handle<Object>::null(); 2523 return Handle<Object>::null();
2515 } 2524 }
2516 2525
2517 2526
2518 Handle<Object> Factory::ToBoolean(bool value) { 2527 Handle<Object> Factory::ToBoolean(bool value) {
2519 return value ? true_value() : false_value(); 2528 return value ? true_value() : false_value();
2520 } 2529 }
2521 2530
2522 2531
2523 } } // namespace v8::internal 2532 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698