OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 2477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2488 void v8::Object::SetPointerInInternalField(int index, void* value) { | 2488 void v8::Object::SetPointerInInternalField(int index, void* value) { |
2489 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); | 2489 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); |
2490 i::Object* as_object = reinterpret_cast<i::Object*>(value); | 2490 i::Object* as_object = reinterpret_cast<i::Object*>(value); |
2491 if (as_object->IsSmi()) { | 2491 if (as_object->IsSmi()) { |
2492 // Aligned pointer, store as is. | 2492 // Aligned pointer, store as is. |
2493 obj->SetInternalField(index, as_object); | 2493 obj->SetInternalField(index, as_object); |
2494 } else { | 2494 } else { |
2495 // Currently internal fields are used by DOM wrappers which only | 2495 // Currently internal fields are used by DOM wrappers which only |
2496 // get garbage collected by the mark-sweep collector, so we | 2496 // get garbage collected by the mark-sweep collector, so we |
2497 // pretenure the proxy. | 2497 // pretenure the proxy. |
| 2498 HandleScope scope; |
2498 i::Handle<i::Proxy> proxy = | 2499 i::Handle<i::Proxy> proxy = |
2499 i::Factory::NewProxy(reinterpret_cast<i::Address>(value), i::TENURED); | 2500 i::Factory::NewProxy(reinterpret_cast<i::Address>(value), i::TENURED); |
2500 if (!proxy.is_null()) obj->SetInternalField(index, *proxy); | 2501 if (!proxy.is_null()) obj->SetInternalField(index, *proxy); |
2501 } | 2502 } |
2502 } | 2503 } |
2503 | 2504 |
2504 | 2505 |
2505 // --- E n v i r o n m e n t --- | 2506 // --- E n v i r o n m e n t --- |
2506 | 2507 |
2507 bool v8::V8::Initialize() { | 2508 bool v8::V8::Initialize() { |
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3563 reinterpret_cast<HandleScopeImplementer*>(storage); | 3564 reinterpret_cast<HandleScopeImplementer*>(storage); |
3564 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); | 3565 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); |
3565 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = | 3566 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = |
3566 &thread_local->handle_scope_data_; | 3567 &thread_local->handle_scope_data_; |
3567 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); | 3568 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); |
3568 | 3569 |
3569 return storage + ArchiveSpacePerThread(); | 3570 return storage + ArchiveSpacePerThread(); |
3570 } | 3571 } |
3571 | 3572 |
3572 } } // namespace v8::internal | 3573 } } // namespace v8::internal |
OLD | NEW |