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

Side by Side Diff: src/bootstrapper.cc

Issue 13192004: arrange to create prototypes for generators (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Explicitly add constructor properties in generator.js Created 7 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
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 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 1314
1315 if (FLAG_harmony_typed_arrays) { 1315 if (FLAG_harmony_typed_arrays) {
1316 { // -- A r r a y B u f f e r 1316 { // -- A r r a y B u f f e r
1317 Handle<JSObject> prototype = 1317 Handle<JSObject> prototype =
1318 factory()->NewJSObject(isolate()->object_function(), TENURED); 1318 factory()->NewJSObject(isolate()->object_function(), TENURED);
1319 InstallFunction(global, "__ArrayBuffer", JS_ARRAY_BUFFER_TYPE, 1319 InstallFunction(global, "__ArrayBuffer", JS_ARRAY_BUFFER_TYPE,
1320 JSArrayBuffer::kSize, prototype, 1320 JSArrayBuffer::kSize, prototype,
1321 Builtins::kIllegal, true); 1321 Builtins::kIllegal, true);
1322 } 1322 }
1323 } 1323 }
1324
1325 if (FLAG_harmony_generators) {
1326 // Create generator meta-objects and install them on the builtins object.
1327 Handle<JSObject> builtins(native_context()->builtins());
1328 Handle<JSObject> generator_object_prototype =
1329 factory()->NewJSObject(isolate()->object_function(), TENURED);
1330 Handle<JSFunction> generator_function_prototype =
1331 InstallFunction(builtins, "GeneratorFunctionPrototype",
1332 JS_FUNCTION_TYPE, JSFunction::kHeaderSize,
1333 generator_object_prototype, Builtins::kIllegal,
1334 false);
1335 InstallFunction(builtins, "GeneratorFunction",
1336 JS_FUNCTION_TYPE, JSFunction::kSize,
1337 generator_function_prototype, Builtins::kIllegal,
1338 false);
1339
1340 // Create maps for generator functions and their prototypes. Store those
1341 // maps in the native context.
1342 Handle<Map> function_map(native_context()->function_map());
1343 Handle<Map> generator_function_map = factory()->CopyMap(function_map);
1344 generator_function_map->set_prototype(*generator_function_prototype);
1345 native_context()->set_generator_function_map(*generator_function_map);
1346
1347 Handle<Map> strict_mode_function_map(
1348 native_context()->strict_mode_function_map());
1349 Handle<Map> strict_mode_generator_function_map = factory()->CopyMap(
1350 strict_mode_function_map);
1351 strict_mode_generator_function_map->set_prototype(
1352 *generator_function_prototype);
1353 native_context()->set_strict_mode_generator_function_map(
1354 *strict_mode_generator_function_map);
1355
1356 Handle<Map> object_map(native_context()->object_function()->initial_map());
1357 Handle<Map> generator_object_prototype_map = factory()->CopyMap(
1358 object_map, 0);
1359 generator_object_prototype_map->set_prototype(
1360 *generator_object_prototype);
1361 native_context()->set_generator_object_prototype_map(
1362 *generator_object_prototype_map);
1363 }
1324 } 1364 }
1325 1365
1326 1366
1327 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { 1367 bool Genesis::CompileBuiltin(Isolate* isolate, int index) {
1328 Vector<const char> name = Natives::GetScriptName(index); 1368 Vector<const char> name = Natives::GetScriptName(index);
1329 Handle<String> source_code = 1369 Handle<String> source_code =
1330 isolate->bootstrapper()->NativesSourceLookup(index); 1370 isolate->bootstrapper()->NativesSourceLookup(index);
1331 return CompileNative(isolate, name, source_code); 1371 return CompileNative(isolate, name, source_code);
1332 } 1372 }
1333 1373
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1926 if (FLAG_harmony_observation && 1966 if (FLAG_harmony_observation &&
1927 strcmp(ExperimentalNatives::GetScriptName(i).start(), 1967 strcmp(ExperimentalNatives::GetScriptName(i).start(),
1928 "native object-observe.js") == 0) { 1968 "native object-observe.js") == 0) {
1929 if (!CompileExperimentalBuiltin(isolate(), i)) return false; 1969 if (!CompileExperimentalBuiltin(isolate(), i)) return false;
1930 } 1970 }
1931 if (FLAG_harmony_typed_arrays && 1971 if (FLAG_harmony_typed_arrays &&
1932 strcmp(ExperimentalNatives::GetScriptName(i).start(), 1972 strcmp(ExperimentalNatives::GetScriptName(i).start(),
1933 "native typedarray.js") == 0) { 1973 "native typedarray.js") == 0) {
1934 if (!CompileExperimentalBuiltin(isolate(), i)) return false; 1974 if (!CompileExperimentalBuiltin(isolate(), i)) return false;
1935 } 1975 }
1976 if (FLAG_harmony_generators &&
1977 strcmp(ExperimentalNatives::GetScriptName(i).start(),
1978 "native generator.js") == 0) {
1979 if (!CompileExperimentalBuiltin(isolate(), i)) return false;
1980 }
1936 } 1981 }
1937 1982
1938 InstallExperimentalNativeFunctions(); 1983 InstallExperimentalNativeFunctions();
1939 1984
1940 return true; 1985 return true;
1941 } 1986 }
1942 1987
1943 1988
1944 static Handle<JSObject> ResolveBuiltinIdHolder( 1989 static Handle<JSObject> ResolveBuiltinIdHolder(
1945 Handle<Context> native_context, 1990 Handle<Context> native_context,
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
2510 return from + sizeof(NestingCounterType); 2555 return from + sizeof(NestingCounterType);
2511 } 2556 }
2512 2557
2513 2558
2514 // Called when the top-level V8 mutex is destroyed. 2559 // Called when the top-level V8 mutex is destroyed.
2515 void Bootstrapper::FreeThreadResources() { 2560 void Bootstrapper::FreeThreadResources() {
2516 ASSERT(!IsActive()); 2561 ASSERT(!IsActive());
2517 } 2562 }
2518 2563
2519 } } // namespace v8::internal 2564 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/code-stubs.h » ('j') | src/generator.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698