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

Side by Side Diff: src/api.cc

Issue 201573007: Revert "Remove Failure::OutOfMemory propagation and V8::IgnoreOutOfMemoryException." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/v8.h ('k') | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 ASSERT(!(isolate)->external_caught_exception()); \ 88 ASSERT(!(isolate)->external_caught_exception()); \
89 bool has_pending_exception = false 89 bool has_pending_exception = false
90 90
91 91
92 #define EXCEPTION_BAILOUT_CHECK_GENERIC(isolate, value, do_callback) \ 92 #define EXCEPTION_BAILOUT_CHECK_GENERIC(isolate, value, do_callback) \
93 do { \ 93 do { \
94 i::HandleScopeImplementer* handle_scope_implementer = \ 94 i::HandleScopeImplementer* handle_scope_implementer = \
95 (isolate)->handle_scope_implementer(); \ 95 (isolate)->handle_scope_implementer(); \
96 handle_scope_implementer->DecrementCallDepth(); \ 96 handle_scope_implementer->DecrementCallDepth(); \
97 if (has_pending_exception) { \ 97 if (has_pending_exception) { \
98 if (handle_scope_implementer->CallDepthIsZero() && \
99 (isolate)->is_out_of_memory()) { \
100 if (!(isolate)->ignore_out_of_memory()) \
101 i::V8::FatalProcessOutOfMemory(NULL); \
102 } \
98 bool call_depth_is_zero = handle_scope_implementer->CallDepthIsZero(); \ 103 bool call_depth_is_zero = handle_scope_implementer->CallDepthIsZero(); \
99 (isolate)->OptionalRescheduleException(call_depth_is_zero); \ 104 (isolate)->OptionalRescheduleException(call_depth_is_zero); \
100 do_callback \ 105 do_callback \
101 return value; \ 106 return value; \
102 } \ 107 } \
103 do_callback \ 108 do_callback \
104 } while (false) 109 } while (false)
105 110
106 111
107 #define EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, value) \ 112 #define EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, value) \
(...skipping 5141 matching lines...) Expand 10 before | Expand all | Expand 10 after
5249 5254
5250 Handle<Value> v8::Context::GetSecurityToken() { 5255 Handle<Value> v8::Context::GetSecurityToken() {
5251 i::Isolate* isolate = i::Isolate::Current(); 5256 i::Isolate* isolate = i::Isolate::Current();
5252 i::Handle<i::Context> env = Utils::OpenHandle(this); 5257 i::Handle<i::Context> env = Utils::OpenHandle(this);
5253 i::Object* security_token = env->security_token(); 5258 i::Object* security_token = env->security_token();
5254 i::Handle<i::Object> token_handle(security_token, isolate); 5259 i::Handle<i::Object> token_handle(security_token, isolate);
5255 return Utils::ToLocal(token_handle); 5260 return Utils::ToLocal(token_handle);
5256 } 5261 }
5257 5262
5258 5263
5264 bool Context::HasOutOfMemoryException() {
5265 i::Handle<i::Context> env = Utils::OpenHandle(this);
5266 return env->has_out_of_memory();
5267 }
5268
5269
5259 v8::Isolate* Context::GetIsolate() { 5270 v8::Isolate* Context::GetIsolate() {
5260 i::Handle<i::Context> env = Utils::OpenHandle(this); 5271 i::Handle<i::Context> env = Utils::OpenHandle(this);
5261 return reinterpret_cast<Isolate*>(env->GetIsolate()); 5272 return reinterpret_cast<Isolate*>(env->GetIsolate());
5262 } 5273 }
5263 5274
5264 5275
5265 v8::Local<v8::Object> Context::Global() { 5276 v8::Local<v8::Object> Context::Global() {
5266 i::Handle<i::Context> context = Utils::OpenHandle(this); 5277 i::Handle<i::Context> context = Utils::OpenHandle(this);
5267 i::Isolate* isolate = context->GetIsolate(); 5278 i::Isolate* isolate = context->GetIsolate();
5268 i::Handle<i::Object> global(context->global_proxy(), isolate); 5279 i::Handle<i::Object> global(context->global_proxy(), isolate);
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
6207 bool fits_into_int32_t = (value & (1 << 31)) == 0; 6218 bool fits_into_int32_t = (value & (1 << 31)) == 0;
6208 if (fits_into_int32_t) { 6219 if (fits_into_int32_t) {
6209 return Integer::New(isolate, static_cast<int32_t>(value)); 6220 return Integer::New(isolate, static_cast<int32_t>(value));
6210 } 6221 }
6211 ENTER_V8(internal_isolate); 6222 ENTER_V8(internal_isolate);
6212 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); 6223 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value);
6213 return Utils::IntegerToLocal(result); 6224 return Utils::IntegerToLocal(result);
6214 } 6225 }
6215 6226
6216 6227
6228 void V8::IgnoreOutOfMemoryException() {
6229 EnterIsolateIfNeeded()->set_ignore_out_of_memory(true);
6230 }
6231
6232
6217 bool V8::AddMessageListener(MessageCallback that, Handle<Value> data) { 6233 bool V8::AddMessageListener(MessageCallback that, Handle<Value> data) {
6218 i::Isolate* isolate = i::Isolate::Current(); 6234 i::Isolate* isolate = i::Isolate::Current();
6219 EnsureInitializedForIsolate(isolate, "v8::V8::AddMessageListener()"); 6235 EnsureInitializedForIsolate(isolate, "v8::V8::AddMessageListener()");
6220 ON_BAILOUT(isolate, "v8::V8::AddMessageListener()", return false); 6236 ON_BAILOUT(isolate, "v8::V8::AddMessageListener()", return false);
6221 ENTER_V8(isolate); 6237 ENTER_V8(isolate);
6222 i::HandleScope scope(isolate); 6238 i::HandleScope scope(isolate);
6223 NeanderArray listeners(isolate->factory()->message_listeners()); 6239 NeanderArray listeners(isolate->factory()->message_listeners());
6224 NeanderObject obj(isolate, 2); 6240 NeanderObject obj(isolate, 2);
6225 obj.set(0, *isolate->factory()->NewForeign(FUNCTION_ADDR(that))); 6241 obj.set(0, *isolate->factory()->NewForeign(FUNCTION_ADDR(that)));
6226 obj.set(1, data.IsEmpty() ? isolate->heap()->undefined_value() 6242 obj.set(1, data.IsEmpty() ? isolate->heap()->undefined_value()
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after
7602 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7618 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7603 Address callback_address = 7619 Address callback_address =
7604 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7620 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7605 VMState<EXTERNAL> state(isolate); 7621 VMState<EXTERNAL> state(isolate);
7606 ExternalCallbackScope call_scope(isolate, callback_address); 7622 ExternalCallbackScope call_scope(isolate, callback_address);
7607 callback(info); 7623 callback(info);
7608 } 7624 }
7609 7625
7610 7626
7611 } } // namespace v8::internal 7627 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698