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 6146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6157 bool fits_into_int32_t = (value & (1 << 31)) == 0; | 6157 bool fits_into_int32_t = (value & (1 << 31)) == 0; |
6158 if (fits_into_int32_t) { | 6158 if (fits_into_int32_t) { |
6159 return Integer::New(isolate, static_cast<int32_t>(value)); | 6159 return Integer::New(isolate, static_cast<int32_t>(value)); |
6160 } | 6160 } |
6161 ENTER_V8(internal_isolate); | 6161 ENTER_V8(internal_isolate); |
6162 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); | 6162 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); |
6163 return Utils::IntegerToLocal(result); | 6163 return Utils::IntegerToLocal(result); |
6164 } | 6164 } |
6165 | 6165 |
6166 | 6166 |
6167 #ifdef DEBUG | |
6168 v8::AssertNoGCScope::AssertNoGCScope(v8::Isolate* isolate) { | |
6169 disallow_heap_allocation_ = new i::DisallowHeapAllocation(); | |
6170 } | |
6171 | |
6172 | |
6173 v8::AssertNoGCScope::~AssertNoGCScope() { | |
6174 delete static_cast<i::DisallowHeapAllocation*>(disallow_heap_allocation_); | |
6175 } | |
6176 #endif | |
6177 | |
6178 | |
6179 void V8::IgnoreOutOfMemoryException() { | 6167 void V8::IgnoreOutOfMemoryException() { |
6180 EnterIsolateIfNeeded()->set_ignore_out_of_memory(true); | 6168 EnterIsolateIfNeeded()->set_ignore_out_of_memory(true); |
6181 } | 6169 } |
6182 | 6170 |
6183 | 6171 |
6184 bool V8::AddMessageListener(MessageCallback that, Handle<Value> data) { | 6172 bool V8::AddMessageListener(MessageCallback that, Handle<Value> data) { |
6185 i::Isolate* isolate = i::Isolate::Current(); | 6173 i::Isolate* isolate = i::Isolate::Current(); |
6186 EnsureInitializedForIsolate(isolate, "v8::V8::AddMessageListener()"); | 6174 EnsureInitializedForIsolate(isolate, "v8::V8::AddMessageListener()"); |
6187 ON_BAILOUT(isolate, "v8::V8::AddMessageListener()", return false); | 6175 ON_BAILOUT(isolate, "v8::V8::AddMessageListener()", return false); |
6188 ENTER_V8(isolate); | 6176 ENTER_V8(isolate); |
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7474 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7462 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7475 Address callback_address = | 7463 Address callback_address = |
7476 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7464 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7477 VMState<EXTERNAL> state(isolate); | 7465 VMState<EXTERNAL> state(isolate); |
7478 ExternalCallbackScope call_scope(isolate, callback_address); | 7466 ExternalCallbackScope call_scope(isolate, callback_address); |
7479 callback(info); | 7467 callback(info); |
7480 } | 7468 } |
7481 | 7469 |
7482 | 7470 |
7483 } } // namespace v8::internal | 7471 } } // namespace v8::internal |
OLD | NEW |