OLD | NEW |
---|---|
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1474 } | 1474 } |
1475 | 1475 |
1476 | 1476 |
1477 void Genesis::BuildSpecialFunctionTable() { | 1477 void Genesis::BuildSpecialFunctionTable() { |
1478 HandleScope scope; | 1478 HandleScope scope; |
1479 Handle<JSObject> global = Handle<JSObject>(global_context()->global()); | 1479 Handle<JSObject> global = Handle<JSObject>(global_context()->global()); |
1480 // Add special versions for Array.prototype.pop and push. | 1480 // Add special versions for Array.prototype.pop and push. |
1481 Handle<JSFunction> function = | 1481 Handle<JSFunction> function = |
1482 Handle<JSFunction>( | 1482 Handle<JSFunction>( |
1483 JSFunction::cast(global->GetProperty(Heap::Array_symbol()))); | 1483 JSFunction::cast(global->GetProperty(Heap::Array_symbol()))); |
1484 Handle<JSObject> visible_prototype = | |
1485 Handle<JSObject>(JSObject::cast(function->prototype())); | |
1486 // Remember to skip the hidden prototype: | |
Kasper Lund
2009/05/06 13:33:05
: -> .
| |
1484 Handle<JSObject> hidden_prototype = | 1487 Handle<JSObject> hidden_prototype = |
1485 Handle<JSObject>(JSObject::cast(function->prototype())); | 1488 Handle<JSObject>(JSObject::cast(visible_prototype->GetPrototype())); |
1489 AddSpecialFunction(hidden_prototype, "pop", | |
1490 Handle<Code>(Builtins::builtin(Builtins::ArrayPop))); | |
1491 AddSpecialFunction(hidden_prototype, "push", | |
1492 Handle<Code>(Builtins::builtin(Builtins::ArrayPush))); | |
1486 ASSERT(hidden_prototype->map()->is_hidden_prototype()); | 1493 ASSERT(hidden_prototype->map()->is_hidden_prototype()); |
1487 // Remember to skip the hidden prototype: | |
1488 Handle<JSObject> real_prototype = | |
1489 Handle<JSObject>(JSObject::cast(hidden_prototype->GetPrototype())); | |
1490 AddSpecialFunction(real_prototype, "pop", | |
1491 Handle<Code>(Builtins::builtin(Builtins::ArrayPop))); | |
1492 AddSpecialFunction(real_prototype, "push", | |
1493 Handle<Code>(Builtins::builtin(Builtins::ArrayPush))); | |
1494 } | 1494 } |
1495 | 1495 |
1496 | 1496 |
1497 Genesis::Genesis(Handle<Object> global_object, | 1497 Genesis::Genesis(Handle<Object> global_object, |
1498 v8::Handle<v8::ObjectTemplate> global_template, | 1498 v8::Handle<v8::ObjectTemplate> global_template, |
1499 v8::ExtensionConfiguration* extensions) { | 1499 v8::ExtensionConfiguration* extensions) { |
1500 // Link this genesis object into the stacked genesis chain. This | 1500 // Link this genesis object into the stacked genesis chain. This |
1501 // must be done before any early exits because the destructor | 1501 // must be done before any early exits because the destructor |
1502 // will always do unlinking. | 1502 // will always do unlinking. |
1503 previous_ = current_; | 1503 previous_ = current_; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1562 } | 1562 } |
1563 | 1563 |
1564 | 1564 |
1565 // Restore statics that are thread local. | 1565 // Restore statics that are thread local. |
1566 char* Genesis::RestoreState(char* from) { | 1566 char* Genesis::RestoreState(char* from) { |
1567 current_ = *reinterpret_cast<Genesis**>(from); | 1567 current_ = *reinterpret_cast<Genesis**>(from); |
1568 return from + sizeof(current_); | 1568 return from + sizeof(current_); |
1569 } | 1569 } |
1570 | 1570 |
1571 } } // namespace v8::internal | 1571 } } // namespace v8::internal |
OLD | NEW |