Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1419 ? top_context->builtins() | 1419 ? top_context->builtins() |
| 1420 : top_context->global_object(), | 1420 : top_context->global_object(), |
| 1421 isolate); | 1421 isolate); |
| 1422 bool has_pending_exception; | 1422 bool has_pending_exception; |
| 1423 Execution::Call(fun, receiver, 0, NULL, &has_pending_exception); | 1423 Execution::Call(fun, receiver, 0, NULL, &has_pending_exception); |
| 1424 if (has_pending_exception) return false; | 1424 if (has_pending_exception) return false; |
| 1425 return true; | 1425 return true; |
| 1426 } | 1426 } |
| 1427 | 1427 |
| 1428 | 1428 |
| 1429 #define LOOKUP_NATIVE(Type, name, var) \ | |
| 1430 Handle<String> var##_name = \ | |
| 1431 factory()->NewStringFromOneByte(STATIC_ASCII_VECTOR(name)); \ | |
| 1432 Object* var##_obj = \ | |
| 1433 native_context()->builtins()->GetPropertyNoExceptionThrown( \ | |
| 1434 *var##_name); \ | |
| 1435 Handle<Type> var(Type::cast(var##_obj)); | |
| 1436 | |
| 1429 #define INSTALL_NATIVE(Type, name, var) \ | 1437 #define INSTALL_NATIVE(Type, name, var) \ |
| 1430 Handle<String> var##_name = \ | 1438 Handle<String> var##_name = \ |
| 1431 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR(name)); \ | 1439 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR(name)); \ |
| 1432 Object* var##_native = \ | 1440 Object* var##_native = \ |
| 1433 native_context()->builtins()->GetPropertyNoExceptionThrown( \ | 1441 native_context()->builtins()->GetPropertyNoExceptionThrown( \ |
| 1434 *var##_name); \ | 1442 *var##_name); \ |
| 1435 native_context()->set_##var(Type::cast(var##_native)); | 1443 native_context()->set_##var(Type::cast(var##_native)); |
| 1436 | 1444 |
| 1437 | 1445 |
| 1438 void Genesis::InstallNativeFunctions() { | 1446 void Genesis::InstallNativeFunctions() { |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 1460 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap); | 1468 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap); |
| 1461 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap); | 1469 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap); |
| 1462 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap); | 1470 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap); |
| 1463 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate); | 1471 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate); |
| 1464 } | 1472 } |
| 1465 if (FLAG_harmony_observation) { | 1473 if (FLAG_harmony_observation) { |
| 1466 INSTALL_NATIVE(JSFunction, "NotifyChange", observers_notify_change); | 1474 INSTALL_NATIVE(JSFunction, "NotifyChange", observers_notify_change); |
| 1467 INSTALL_NATIVE(JSFunction, "DeliverChangeRecords", | 1475 INSTALL_NATIVE(JSFunction, "DeliverChangeRecords", |
| 1468 observers_deliver_changes); | 1476 observers_deliver_changes); |
| 1469 } | 1477 } |
| 1478 if (FLAG_harmony_generators) { | |
|
rossberg
2013/04/09 16:44:14
Why do these have to be created in a different man
wingo
2013/04/10 14:28:52
I have taken a look at this and I don't catch your
wingo
2013/04/10 14:44:28
I think I misunderstood and found my error. Pleas
| |
| 1479 HandleScope scope(isolate()); | |
| 1480 LOOKUP_NATIVE(JSFunction, "GeneratorFunctionPrototype", | |
| 1481 generator_function_prototype); | |
| 1482 LOOKUP_NATIVE(JSObject, "GeneratorIteratorPrototype", | |
| 1483 generator_iterator_prototype); | |
| 1484 Handle<Map> function_map(native_context()->function_map()); | |
| 1485 Handle<Map> strict_mode_function_map( | |
| 1486 native_context()->strict_mode_function_map()); | |
| 1487 Handle<Map> object_map(native_context()->object_function()->initial_map()); | |
| 1488 | |
| 1489 Handle<Map> generator_function_map = factory()->CopyMap(function_map); | |
| 1490 generator_function_map->set_prototype(*generator_function_prototype); | |
| 1491 native_context()->set_generator_function_map(*generator_function_map); | |
| 1492 | |
| 1493 Handle<Map> strict_mode_generator_function_map = factory()->CopyMap( | |
| 1494 strict_mode_function_map); | |
| 1495 strict_mode_generator_function_map->set_prototype( | |
| 1496 *generator_function_prototype); | |
| 1497 native_context()->set_strict_mode_generator_function_map( | |
| 1498 *strict_mode_generator_function_map); | |
| 1499 | |
| 1500 Handle<Map> generator_iterator_prototype_map = factory()->CopyMap( | |
| 1501 object_map, 0); | |
| 1502 generator_iterator_prototype_map->set_prototype( | |
| 1503 *generator_iterator_prototype); | |
| 1504 native_context()->set_generator_iterator_prototype_map( | |
| 1505 *generator_iterator_prototype_map); | |
| 1506 } | |
| 1470 } | 1507 } |
| 1471 | 1508 |
| 1472 #undef INSTALL_NATIVE | 1509 #undef INSTALL_NATIVE |
| 1473 | 1510 |
| 1474 | 1511 |
| 1475 Handle<JSFunction> Genesis::InstallInternalArray( | 1512 Handle<JSFunction> Genesis::InstallInternalArray( |
| 1476 Handle<JSBuiltinsObject> builtins, | 1513 Handle<JSBuiltinsObject> builtins, |
| 1477 const char* name, | 1514 const char* name, |
| 1478 ElementsKind elements_kind) { | 1515 ElementsKind elements_kind) { |
| 1479 // --- I n t e r n a l A r r a y --- | 1516 // --- I n t e r n a l A r r a y --- |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1926 if (FLAG_harmony_observation && | 1963 if (FLAG_harmony_observation && |
| 1927 strcmp(ExperimentalNatives::GetScriptName(i).start(), | 1964 strcmp(ExperimentalNatives::GetScriptName(i).start(), |
| 1928 "native object-observe.js") == 0) { | 1965 "native object-observe.js") == 0) { |
| 1929 if (!CompileExperimentalBuiltin(isolate(), i)) return false; | 1966 if (!CompileExperimentalBuiltin(isolate(), i)) return false; |
| 1930 } | 1967 } |
| 1931 if (FLAG_harmony_typed_arrays && | 1968 if (FLAG_harmony_typed_arrays && |
| 1932 strcmp(ExperimentalNatives::GetScriptName(i).start(), | 1969 strcmp(ExperimentalNatives::GetScriptName(i).start(), |
| 1933 "native typedarray.js") == 0) { | 1970 "native typedarray.js") == 0) { |
| 1934 if (!CompileExperimentalBuiltin(isolate(), i)) return false; | 1971 if (!CompileExperimentalBuiltin(isolate(), i)) return false; |
| 1935 } | 1972 } |
| 1973 if (FLAG_harmony_generators && | |
| 1974 strcmp(ExperimentalNatives::GetScriptName(i).start(), | |
| 1975 "native generators.js") == 0) { | |
| 1976 if (!CompileExperimentalBuiltin(isolate(), i)) return false; | |
| 1977 } | |
| 1936 } | 1978 } |
| 1937 | 1979 |
| 1938 InstallExperimentalNativeFunctions(); | 1980 InstallExperimentalNativeFunctions(); |
| 1939 | 1981 |
| 1940 return true; | 1982 return true; |
| 1941 } | 1983 } |
| 1942 | 1984 |
| 1943 | 1985 |
| 1944 static Handle<JSObject> ResolveBuiltinIdHolder( | 1986 static Handle<JSObject> ResolveBuiltinIdHolder( |
| 1945 Handle<Context> native_context, | 1987 Handle<Context> native_context, |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2510 return from + sizeof(NestingCounterType); | 2552 return from + sizeof(NestingCounterType); |
| 2511 } | 2553 } |
| 2512 | 2554 |
| 2513 | 2555 |
| 2514 // Called when the top-level V8 mutex is destroyed. | 2556 // Called when the top-level V8 mutex is destroyed. |
| 2515 void Bootstrapper::FreeThreadResources() { | 2557 void Bootstrapper::FreeThreadResources() { |
| 2516 ASSERT(!IsActive()); | 2558 ASSERT(!IsActive()); |
| 2517 } | 2559 } |
| 2518 | 2560 |
| 2519 } } // namespace v8::internal | 2561 } } // namespace v8::internal |
| OLD | NEW |