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 5200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5211 i::Handle<i::Object> result = isolate->factory()->NewNumber(value); | 5211 i::Handle<i::Object> result = isolate->factory()->NewNumber(value); |
5212 return Utils::IntegerToLocal(result); | 5212 return Utils::IntegerToLocal(result); |
5213 } | 5213 } |
5214 | 5214 |
5215 | 5215 |
5216 void V8::IgnoreOutOfMemoryException() { | 5216 void V8::IgnoreOutOfMemoryException() { |
5217 EnterIsolateIfNeeded()->set_ignore_out_of_memory(true); | 5217 EnterIsolateIfNeeded()->set_ignore_out_of_memory(true); |
5218 } | 5218 } |
5219 | 5219 |
5220 | 5220 |
5221 bool V8::AddMessageListener(MessageCallback that, Handle<Value> data) { | 5221 bool V8::AddMessageListener(MessageCallback that) { |
5222 i::Isolate* isolate = i::Isolate::Current(); | 5222 i::Isolate* isolate = i::Isolate::Current(); |
5223 EnsureInitializedForIsolate(isolate, "v8::V8::AddMessageListener()"); | 5223 EnsureInitializedForIsolate(isolate, "v8::V8::AddMessageListener()"); |
5224 ON_BAILOUT(isolate, "v8::V8::AddMessageListener()", return false); | 5224 ON_BAILOUT(isolate, "v8::V8::AddMessageListener()", return false); |
5225 ENTER_V8(isolate); | 5225 ENTER_V8(isolate); |
5226 i::HandleScope scope(isolate); | 5226 i::HandleScope scope(isolate); |
5227 NeanderArray listeners(isolate->factory()->message_listeners()); | 5227 NeanderArray listeners(isolate->factory()->message_listeners()); |
5228 NeanderObject obj(2); | 5228 listeners.add(isolate->factory()->NewForeign(FUNCTION_ADDR(that))); |
5229 obj.set(0, *isolate->factory()->NewForeign(FUNCTION_ADDR(that))); | |
5230 obj.set(1, data.IsEmpty() ? | |
5231 isolate->heap()->undefined_value() : | |
5232 *Utils::OpenHandle(*data)); | |
5233 listeners.add(obj.value()); | |
5234 return true; | 5229 return true; |
5235 } | 5230 } |
5236 | 5231 |
5237 | 5232 |
5238 void V8::RemoveMessageListeners(MessageCallback that) { | 5233 void V8::RemoveMessageListeners(MessageCallback that) { |
5239 i::Isolate* isolate = i::Isolate::Current(); | 5234 i::Isolate* isolate = i::Isolate::Current(); |
5240 EnsureInitializedForIsolate(isolate, "v8::V8::RemoveMessageListener()"); | 5235 EnsureInitializedForIsolate(isolate, "v8::V8::RemoveMessageListener()"); |
5241 ON_BAILOUT(isolate, "v8::V8::RemoveMessageListeners()", return); | 5236 ON_BAILOUT(isolate, "v8::V8::RemoveMessageListeners()", return); |
5242 ENTER_V8(isolate); | 5237 ENTER_V8(isolate); |
5243 i::HandleScope scope(isolate); | 5238 i::HandleScope scope(isolate); |
5244 NeanderArray listeners(isolate->factory()->message_listeners()); | 5239 NeanderArray listeners(isolate->factory()->message_listeners()); |
5245 for (int i = 0; i < listeners.length(); i++) { | 5240 for (int i = 0; i < listeners.length(); i++) { |
5246 if (listeners.get(i)->IsUndefined()) continue; // skip deleted ones | 5241 if (listeners.get(i)->IsUndefined()) continue; // skip deleted ones |
5247 | 5242 |
5248 NeanderObject listener(i::JSObject::cast(listeners.get(i))); | 5243 i::Handle<i::Foreign> callback_obj(i::Foreign::cast(listeners.get(i))); |
5249 i::Handle<i::Foreign> callback_obj(i::Foreign::cast(listener.get(0))); | |
5250 if (callback_obj->foreign_address() == FUNCTION_ADDR(that)) { | 5244 if (callback_obj->foreign_address() == FUNCTION_ADDR(that)) { |
5251 listeners.set(i, isolate->heap()->undefined_value()); | 5245 listeners.set(i, isolate->heap()->undefined_value()); |
5252 } | 5246 } |
5253 } | 5247 } |
5254 } | 5248 } |
5255 | 5249 |
5256 | 5250 |
5257 void V8::SetCaptureStackTraceForUncaughtExceptions( | 5251 void V8::SetCaptureStackTraceForUncaughtExceptions( |
5258 bool capture, | 5252 bool capture, |
5259 int frame_limit, | 5253 int frame_limit, |
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6590 | 6584 |
6591 v->VisitPointers(blocks_.first(), first_block_limit_); | 6585 v->VisitPointers(blocks_.first(), first_block_limit_); |
6592 | 6586 |
6593 for (int i = 1; i < blocks_.length(); i++) { | 6587 for (int i = 1; i < blocks_.length(); i++) { |
6594 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); | 6588 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); |
6595 } | 6589 } |
6596 } | 6590 } |
6597 | 6591 |
6598 | 6592 |
6599 } } // namespace v8::internal | 6593 } } // namespace v8::internal |
OLD | NEW |