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

Unified Diff: src/api.cc

Issue 2195243003: [api] Remove NeanderObject (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@2016-07-29_api_remove_NeanderArray_2196533003
Patch Set: fixing rebase issues Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/api.h ('k') | src/messages.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 2e82e05c99dfbd9a5b6e684b64dc6421f968dd0c..a6843345b71f6a4640c9d4f6434d24a571a208e1 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -1031,27 +1031,6 @@ void Context::SetAlignedPointerInEmbedderData(int index, void* value) {
}
-// --- N e a n d e r ---
-
-
-// A constructor cannot easily return an error value, therefore it is necessary
-// to check for a dead VM with ON_BAILOUT before constructing any Neander
-// objects. To remind you about this there is no HandleScope in the
-// NeanderObject constructor. When you add one to the site calling the
-// constructor you should check that you ensured the VM was not dead first.
-NeanderObject::NeanderObject(v8::internal::Isolate* isolate, int size) {
- ENTER_V8(isolate);
- value_ = isolate->factory()->NewNeanderObject();
- i::Handle<i::FixedArray> elements = isolate->factory()->NewFixedArray(size);
- value_->set_elements(*elements);
-}
-
-
-int NeanderObject::size() {
- return i::FixedArray::cast(value_->elements())->length();
-}
-
-
// --- T e m p l a t e ---
@@ -7940,11 +7919,13 @@ bool Isolate::AddMessageListener(MessageCallback that, Local<Value> data) {
ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::TemplateList> list = isolate->factory()->message_listeners();
- NeanderObject obj(isolate, 2);
- obj.set(0, *isolate->factory()->NewForeign(FUNCTION_ADDR(that)));
- obj.set(1, data.IsEmpty() ? isolate->heap()->undefined_value()
- : *Utils::OpenHandle(*data));
- list = i::TemplateList::Add(isolate, list, obj.value());
+ i::Handle<i::FixedArray> listener = isolate->factory()->NewFixedArray(2);
+ i::Handle<i::Foreign> foreign =
+ isolate->factory()->NewForeign(FUNCTION_ADDR(that));
+ listener->set(0, *foreign);
+ listener->set(1, data.IsEmpty() ? isolate->heap()->undefined_value()
+ : *Utils::OpenHandle(*data));
+ list = i::TemplateList::Add(isolate, list, listener);
isolate->heap()->SetMessageListeners(*list);
return true;
}
@@ -7958,9 +7939,8 @@ void Isolate::RemoveMessageListeners(MessageCallback that) {
i::TemplateList* listeners = isolate->heap()->message_listeners();
for (int i = 0; i < listeners->length(); i++) {
if (listeners->get(i)->IsUndefined(isolate)) continue; // skip deleted ones
-
- NeanderObject listener(i::JSObject::cast(listeners->get(i)));
- i::Foreign* callback_obj = i::Foreign::cast(listener.get(0));
+ i::FixedArray* listener = i::FixedArray::cast(listeners->get(i));
+ i::Foreign* callback_obj = i::Foreign::cast(listener->get(0));
if (callback_obj->foreign_address() == FUNCTION_ADDR(that)) {
listeners->set(i, isolate->heap()->undefined_value());
}
« no previous file with comments | « src/api.h ('k') | src/messages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698