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

Side by Side Diff: src/factory.cc

Issue 900123003: Add NativeWeakMap to v8.h (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Applied r26428 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 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2230 Handle<JSObject> result = NewJSObjectFromMap(map); 2230 Handle<JSObject> result = NewJSObjectFromMap(map);
2231 Handle<Smi> value(Smi::FromInt(length), isolate()); 2231 Handle<Smi> value(Smi::FromInt(length), isolate());
2232 Object::SetProperty(result, length_string(), value, STRICT).Assert(); 2232 Object::SetProperty(result, length_string(), value, STRICT).Assert();
2233 if (!strict_mode_callee) { 2233 if (!strict_mode_callee) {
2234 Object::SetProperty(result, callee_string(), callee, STRICT).Assert(); 2234 Object::SetProperty(result, callee_string(), callee, STRICT).Assert();
2235 } 2235 }
2236 return result; 2236 return result;
2237 } 2237 }
2238 2238
2239 2239
2240 Handle<JSWeakMap> Factory::NewJSWeakMap() {
2241 // TODO(adamk): Currently the map is only created three times per
2242 // isolate. If it's created more often, the map should be moved into the
2243 // strong root list.
2244 Handle<Map> map = NewMap(JS_WEAK_MAP_TYPE, JSWeakMap::kSize);
2245 return Handle<JSWeakMap>::cast(NewJSObjectFromMap(map));
2246 }
2247
2248
2240 Handle<Map> Factory::ObjectLiteralMapFromCache(Handle<Context> context, 2249 Handle<Map> Factory::ObjectLiteralMapFromCache(Handle<Context> context,
2241 int number_of_properties, 2250 int number_of_properties,
2242 bool* is_result_from_cache) { 2251 bool* is_result_from_cache) {
2243 const int kMapCacheSize = 128; 2252 const int kMapCacheSize = 128;
2244 2253
2245 if (number_of_properties > kMapCacheSize) { 2254 if (number_of_properties > kMapCacheSize) {
2246 *is_result_from_cache = false; 2255 *is_result_from_cache = false;
2247 return Map::Create(isolate(), number_of_properties); 2256 return Map::Create(isolate(), number_of_properties);
2248 } 2257 }
2249 *is_result_from_cache = true; 2258 *is_result_from_cache = true;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
2320 return Handle<Object>::null(); 2329 return Handle<Object>::null();
2321 } 2330 }
2322 2331
2323 2332
2324 Handle<Object> Factory::ToBoolean(bool value) { 2333 Handle<Object> Factory::ToBoolean(bool value) {
2325 return value ? true_value() : false_value(); 2334 return value ? true_value() : false_value();
2326 } 2335 }
2327 2336
2328 2337
2329 } } // namespace v8::internal 2338 } } // 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