OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 21 matching lines...) Expand all Loading... |
32 #include "bootstrapper.h" | 32 #include "bootstrapper.h" |
33 #include "compiler.h" | 33 #include "compiler.h" |
34 #include "debug.h" | 34 #include "debug.h" |
35 #include "execution.h" | 35 #include "execution.h" |
36 #include "global-handles.h" | 36 #include "global-handles.h" |
37 #include "natives.h" | 37 #include "natives.h" |
38 #include "runtime.h" | 38 #include "runtime.h" |
39 | 39 |
40 namespace v8 { namespace internal { | 40 namespace v8 { namespace internal { |
41 | 41 |
42 #define CALL_GC(RESULT) \ | |
43 { \ | |
44 Failure* __failure__ = Failure::cast(RESULT); \ | |
45 if (!Heap::CollectGarbage(__failure__->requested(), \ | |
46 __failure__->allocation_space())) { \ | |
47 /* TODO(1181417): Fix this. */ \ | |
48 V8::FatalProcessOutOfMemory("Handles"); \ | |
49 } \ | |
50 } | |
51 | |
52 | 42 |
53 Handle<FixedArray> AddKeysFromJSArray(Handle<FixedArray> content, | 43 Handle<FixedArray> AddKeysFromJSArray(Handle<FixedArray> content, |
54 Handle<JSArray> array) { | 44 Handle<JSArray> array) { |
55 CALL_HEAP_FUNCTION(content->AddKeysFromJSArray(*array), FixedArray); | 45 CALL_HEAP_FUNCTION(content->AddKeysFromJSArray(*array), FixedArray); |
56 } | 46 } |
57 | 47 |
58 | 48 |
59 Handle<FixedArray> UnionOfKeys(Handle<FixedArray> first, | 49 Handle<FixedArray> UnionOfKeys(Handle<FixedArray> first, |
60 Handle<FixedArray> second) { | 50 Handle<FixedArray> second) { |
61 CALL_HEAP_FUNCTION(first->UnionOfKeys(*second), FixedArray); | 51 CALL_HEAP_FUNCTION(first->UnionOfKeys(*second), FixedArray); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 // Create a new weak global handle and use it to cache the wrapper | 266 // Create a new weak global handle and use it to cache the wrapper |
277 // for future use. The cache will automatically be cleared by the | 267 // for future use. The cache will automatically be cleared by the |
278 // garbage collector when it is not used anymore. | 268 // garbage collector when it is not used anymore. |
279 Handle<Object> handle = GlobalHandles::Create(*result); | 269 Handle<Object> handle = GlobalHandles::Create(*result); |
280 GlobalHandles::MakeWeak(handle.location(), NULL, &ClearWrapperCache); | 270 GlobalHandles::MakeWeak(handle.location(), NULL, &ClearWrapperCache); |
281 script->wrapper()->set_proxy(reinterpret_cast<Address>(handle.location())); | 271 script->wrapper()->set_proxy(reinterpret_cast<Address>(handle.location())); |
282 return result; | 272 return result; |
283 } | 273 } |
284 | 274 |
285 | 275 |
286 #undef CALL_HEAP_FUNCTION | |
287 #undef CALL_GC | |
288 | |
289 | |
290 // Compute the property keys from the interceptor. | 276 // Compute the property keys from the interceptor. |
291 v8::Handle<v8::Array> GetKeysForNamedInterceptor(Handle<JSObject> receiver, | 277 v8::Handle<v8::Array> GetKeysForNamedInterceptor(Handle<JSObject> receiver, |
292 Handle<JSObject> object) { | 278 Handle<JSObject> object) { |
293 Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor()); | 279 Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor()); |
294 Handle<Object> data(interceptor->data()); | 280 Handle<Object> data(interceptor->data()); |
295 v8::AccessorInfo info( | 281 v8::AccessorInfo info( |
296 v8::Utils::ToLocal(receiver), | 282 v8::Utils::ToLocal(receiver), |
297 v8::Utils::ToLocal(data), | 283 v8::Utils::ToLocal(data), |
298 v8::Utils::ToLocal(object)); | 284 v8::Utils::ToLocal(object)); |
299 v8::Handle<v8::Array> result; | 285 v8::Handle<v8::Array> result; |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 Handle<Context> compile_context, | 526 Handle<Context> compile_context, |
541 Handle<Context> function_context) { | 527 Handle<Context> function_context) { |
542 Handle<FixedArray> arr = Factory::NewFixedArray(3); | 528 Handle<FixedArray> arr = Factory::NewFixedArray(3); |
543 arr->set(0, Smi::FromInt(index)); | 529 arr->set(0, Smi::FromInt(index)); |
544 arr->set(1, *compile_context); // Compile in this context | 530 arr->set(1, *compile_context); // Compile in this context |
545 arr->set(2, *function_context); // Set function context to this | 531 arr->set(2, *function_context); // Set function context to this |
546 fun->shared()->set_lazy_load_data(*arr); | 532 fun->shared()->set_lazy_load_data(*arr); |
547 } | 533 } |
548 | 534 |
549 } } // namespace v8::internal | 535 } } // namespace v8::internal |
OLD | NEW |