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

Side by Side Diff: src/bootstrapper.cc

Issue 8372027: Implement Harmony sets and maps. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Andreas Rossberg. Created 9 years, 1 month 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 1220
1221 // Initialize the data slot. 1221 // Initialize the data slot.
1222 global_context()->set_data(heap->undefined_value()); 1222 global_context()->set_data(heap->undefined_value());
1223 } 1223 }
1224 1224
1225 1225
1226 void Genesis::InitializeExperimentalGlobal() { 1226 void Genesis::InitializeExperimentalGlobal() {
1227 Handle<JSObject> global = Handle<JSObject>(global_context()->global()); 1227 Handle<JSObject> global = Handle<JSObject>(global_context()->global());
1228 1228
1229 // TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no 1229 // TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no
1230 // longer need to live behind a flag, so WeakMap gets added to the snapshot. 1230 // longer need to live behind a flag, so functions get added to the snapshot.
1231 if (FLAG_harmony_weakmaps) { // -- W e a k M a p 1231 if (FLAG_harmony_collections) {
1232 Handle<JSObject> prototype = 1232 { // -- S e t
1233 factory()->NewJSObject(isolate()->object_function(), TENURED); 1233 Handle<JSObject> prototype =
1234 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize, 1234 factory()->NewJSObject(isolate()->object_function(), TENURED);
1235 prototype, Builtins::kIllegal, true); 1235 InstallFunction(global, "Set", JS_SET_TYPE, JSSet::kSize,
1236 prototype, Builtins::kIllegal, true);
1237 }
1238 { // -- M a p
1239 Handle<JSObject> prototype =
1240 factory()->NewJSObject(isolate()->object_function(), TENURED);
1241 InstallFunction(global, "Map", JS_MAP_TYPE, JSMap::kSize,
1242 prototype, Builtins::kIllegal, true);
1243 }
1244 { // -- W e a k M a p
1245 Handle<JSObject> prototype =
1246 factory()->NewJSObject(isolate()->object_function(), TENURED);
1247 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize,
1248 prototype, Builtins::kIllegal, true);
1249 }
1236 } 1250 }
1237 } 1251 }
1238 1252
1239 1253
1240 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { 1254 bool Genesis::CompileBuiltin(Isolate* isolate, int index) {
1241 Vector<const char> name = Natives::GetScriptName(index); 1255 Vector<const char> name = Natives::GetScriptName(index);
1242 Handle<String> source_code = 1256 Handle<String> source_code =
1243 isolate->bootstrapper()->NativesSourceLookup(index); 1257 isolate->bootstrapper()->NativesSourceLookup(index);
1244 return CompileNative(name, source_code); 1258 return CompileNative(name, source_code);
1245 } 1259 }
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
1733 1747
1734 bool Genesis::InstallExperimentalNatives() { 1748 bool Genesis::InstallExperimentalNatives() {
1735 for (int i = ExperimentalNatives::GetDebuggerCount(); 1749 for (int i = ExperimentalNatives::GetDebuggerCount();
1736 i < ExperimentalNatives::GetBuiltinsCount(); 1750 i < ExperimentalNatives::GetBuiltinsCount();
1737 i++) { 1751 i++) {
1738 if (FLAG_harmony_proxies && 1752 if (FLAG_harmony_proxies &&
1739 strcmp(ExperimentalNatives::GetScriptName(i).start(), 1753 strcmp(ExperimentalNatives::GetScriptName(i).start(),
1740 "native proxy.js") == 0) { 1754 "native proxy.js") == 0) {
1741 if (!CompileExperimentalBuiltin(isolate(), i)) return false; 1755 if (!CompileExperimentalBuiltin(isolate(), i)) return false;
1742 } 1756 }
1743 if (FLAG_harmony_weakmaps && 1757 if (FLAG_harmony_collections &&
1744 strcmp(ExperimentalNatives::GetScriptName(i).start(), 1758 strcmp(ExperimentalNatives::GetScriptName(i).start(),
1745 "native weakmap.js") == 0) { 1759 "native collection.js") == 0) {
1746 if (!CompileExperimentalBuiltin(isolate(), i)) return false; 1760 if (!CompileExperimentalBuiltin(isolate(), i)) return false;
1747 } 1761 }
1748 } 1762 }
1749 1763
1750 InstallExperimentalNativeFunctions(); 1764 InstallExperimentalNativeFunctions();
1751 1765
1752 return true; 1766 return true;
1753 } 1767 }
1754 1768
1755 1769
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
2267 return from + sizeof(NestingCounterType); 2281 return from + sizeof(NestingCounterType);
2268 } 2282 }
2269 2283
2270 2284
2271 // Called when the top-level V8 mutex is destroyed. 2285 // Called when the top-level V8 mutex is destroyed.
2272 void Bootstrapper::FreeThreadResources() { 2286 void Bootstrapper::FreeThreadResources() {
2273 ASSERT(!IsActive()); 2287 ASSERT(!IsActive());
2274 } 2288 }
2275 2289
2276 } } // namespace v8::internal 2290 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/SConscript ('k') | src/collection.js » ('j') | src/flag-definitions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698