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

Side by Side Diff: src/api.cc

Issue 209903003: Reland "Remove Failure::OutOfMemory propagation and V8::IgnoreOutOfMemoryException." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix 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 } \
103 bool call_depth_is_zero = handle_scope_implementer->CallDepthIsZero(); \ 98 bool call_depth_is_zero = handle_scope_implementer->CallDepthIsZero(); \
104 (isolate)->OptionalRescheduleException(call_depth_is_zero); \ 99 (isolate)->OptionalRescheduleException(call_depth_is_zero); \
105 do_callback \ 100 do_callback \
106 return value; \ 101 return value; \
107 } \ 102 } \
108 do_callback \ 103 do_callback \
109 } while (false) 104 } while (false)
110 105
111 106
112 #define EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, value) \ 107 #define EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, value) \
(...skipping 5141 matching lines...) Expand 10 before | Expand all | Expand 10 after
5254 5249
5255 Handle<Value> v8::Context::GetSecurityToken() { 5250 Handle<Value> v8::Context::GetSecurityToken() {
5256 i::Isolate* isolate = i::Isolate::Current(); 5251 i::Isolate* isolate = i::Isolate::Current();
5257 i::Handle<i::Context> env = Utils::OpenHandle(this); 5252 i::Handle<i::Context> env = Utils::OpenHandle(this);
5258 i::Object* security_token = env->security_token(); 5253 i::Object* security_token = env->security_token();
5259 i::Handle<i::Object> token_handle(security_token, isolate); 5254 i::Handle<i::Object> token_handle(security_token, isolate);
5260 return Utils::ToLocal(token_handle); 5255 return Utils::ToLocal(token_handle);
5261 } 5256 }
5262 5257
5263 5258
5264 bool Context::HasOutOfMemoryException() {
5265 i::Handle<i::Context> env = Utils::OpenHandle(this);
5266 return env->has_out_of_memory();
5267 }
5268
5269
5270 v8::Isolate* Context::GetIsolate() { 5259 v8::Isolate* Context::GetIsolate() {
5271 i::Handle<i::Context> env = Utils::OpenHandle(this); 5260 i::Handle<i::Context> env = Utils::OpenHandle(this);
5272 return reinterpret_cast<Isolate*>(env->GetIsolate()); 5261 return reinterpret_cast<Isolate*>(env->GetIsolate());
5273 } 5262 }
5274 5263
5275 5264
5276 v8::Local<v8::Object> Context::Global() { 5265 v8::Local<v8::Object> Context::Global() {
5277 i::Handle<i::Context> context = Utils::OpenHandle(this); 5266 i::Handle<i::Context> context = Utils::OpenHandle(this);
5278 i::Isolate* isolate = context->GetIsolate(); 5267 i::Isolate* isolate = context->GetIsolate();
5279 i::Handle<i::Object> global(context->global_proxy(), isolate); 5268 i::Handle<i::Object> global(context->global_proxy(), isolate);
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
6218 bool fits_into_int32_t = (value & (1 << 31)) == 0; 6207 bool fits_into_int32_t = (value & (1 << 31)) == 0;
6219 if (fits_into_int32_t) { 6208 if (fits_into_int32_t) {
6220 return Integer::New(isolate, static_cast<int32_t>(value)); 6209 return Integer::New(isolate, static_cast<int32_t>(value));
6221 } 6210 }
6222 ENTER_V8(internal_isolate); 6211 ENTER_V8(internal_isolate);
6223 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); 6212 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value);
6224 return Utils::IntegerToLocal(result); 6213 return Utils::IntegerToLocal(result);
6225 } 6214 }
6226 6215
6227 6216
6228 void V8::IgnoreOutOfMemoryException() {
6229 EnterIsolateIfNeeded()->set_ignore_out_of_memory(true);
6230 }
6231
6232
6233 bool V8::AddMessageListener(MessageCallback that, Handle<Value> data) { 6217 bool V8::AddMessageListener(MessageCallback that, Handle<Value> data) {
6234 i::Isolate* isolate = i::Isolate::Current(); 6218 i::Isolate* isolate = i::Isolate::Current();
6235 EnsureInitializedForIsolate(isolate, "v8::V8::AddMessageListener()"); 6219 EnsureInitializedForIsolate(isolate, "v8::V8::AddMessageListener()");
6236 ON_BAILOUT(isolate, "v8::V8::AddMessageListener()", return false); 6220 ON_BAILOUT(isolate, "v8::V8::AddMessageListener()", return false);
6237 ENTER_V8(isolate); 6221 ENTER_V8(isolate);
6238 i::HandleScope scope(isolate); 6222 i::HandleScope scope(isolate);
6239 NeanderArray listeners(isolate->factory()->message_listeners()); 6223 NeanderArray listeners(isolate->factory()->message_listeners());
6240 NeanderObject obj(isolate, 2); 6224 NeanderObject obj(isolate, 2);
6241 obj.set(0, *isolate->factory()->NewForeign(FUNCTION_ADDR(that))); 6225 obj.set(0, *isolate->factory()->NewForeign(FUNCTION_ADDR(that)));
6242 obj.set(1, data.IsEmpty() ? isolate->heap()->undefined_value() 6226 obj.set(1, data.IsEmpty() ? isolate->heap()->undefined_value()
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after
7618 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7602 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7619 Address callback_address = 7603 Address callback_address =
7620 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7604 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7621 VMState<EXTERNAL> state(isolate); 7605 VMState<EXTERNAL> state(isolate);
7622 ExternalCallbackScope call_scope(isolate, callback_address); 7606 ExternalCallbackScope call_scope(isolate, callback_address);
7623 callback(info); 7607 callback(info);
7624 } 7608 }
7625 7609
7626 7610
7627 } } // namespace v8::internal 7611 } } // 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