OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 // Check if boilerplate exists. If not, create it first. | 586 // Check if boilerplate exists. If not, create it first. |
587 Handle<Object> boilerplate(literals->get(literals_index), isolate); | 587 Handle<Object> boilerplate(literals->get(literals_index), isolate); |
588 if (*boilerplate == isolate->heap()->undefined_value()) { | 588 if (*boilerplate == isolate->heap()->undefined_value()) { |
589 boilerplate = CreateArrayLiteralBoilerplate(isolate, literals, elements); | 589 boilerplate = CreateArrayLiteralBoilerplate(isolate, literals, elements); |
590 if (boilerplate.is_null()) return Failure::Exception(); | 590 if (boilerplate.is_null()) return Failure::Exception(); |
591 // Update the functions literal and return the boilerplate. | 591 // Update the functions literal and return the boilerplate. |
592 literals->set(literals_index, *boilerplate); | 592 literals->set(literals_index, *boilerplate); |
593 } | 593 } |
594 if (JSObject::cast(*boilerplate)->elements()->map() == | 594 if (JSObject::cast(*boilerplate)->elements()->map() == |
595 isolate->heap()->fixed_cow_array_map()) { | 595 isolate->heap()->fixed_cow_array_map()) { |
596 COUNTERS->cow_arrays_created_runtime()->Increment(); | 596 isolate->counters()->cow_arrays_created_runtime()->Increment(); |
597 } | 597 } |
598 return isolate->heap()->CopyJSObject(JSObject::cast(*boilerplate)); | 598 return isolate->heap()->CopyJSObject(JSObject::cast(*boilerplate)); |
599 } | 599 } |
600 | 600 |
601 | 601 |
602 static MaybeObject* Runtime_CreateCatchExtensionObject( | 602 static MaybeObject* Runtime_CreateCatchExtensionObject( |
603 RUNTIME_CALLING_CONVENTION) { | 603 RUNTIME_CALLING_CONVENTION) { |
604 RUNTIME_GET_ISOLATE; | 604 RUNTIME_GET_ISOLATE; |
605 ASSERT(args.length() == 2); | 605 ASSERT(args.length() == 2); |
606 CONVERT_CHECKED(String, key, args[0]); | 606 CONVERT_CHECKED(String, key, args[0]); |
(...skipping 11604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12211 return NULL; | 12211 return NULL; |
12212 } | 12212 } |
12213 | 12213 |
12214 | 12214 |
12215 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 12215 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
12216 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 12216 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
12217 } | 12217 } |
12218 | 12218 |
12219 | 12219 |
12220 void Runtime::PerformGC(Object* result) { | 12220 void Runtime::PerformGC(Object* result) { |
| 12221 Isolate* isolate = Isolate::Current(); |
12221 Failure* failure = Failure::cast(result); | 12222 Failure* failure = Failure::cast(result); |
12222 if (failure->IsRetryAfterGC()) { | 12223 if (failure->IsRetryAfterGC()) { |
12223 // Try to do a garbage collection; ignore it if it fails. The C | 12224 // Try to do a garbage collection; ignore it if it fails. The C |
12224 // entry stub will throw an out-of-memory exception in that case. | 12225 // entry stub will throw an out-of-memory exception in that case. |
12225 HEAP->CollectGarbage(failure->allocation_space()); | 12226 isolate->heap()->CollectGarbage(failure->allocation_space()); |
12226 } else { | 12227 } else { |
12227 // Handle last resort GC and make sure to allow future allocations | 12228 // Handle last resort GC and make sure to allow future allocations |
12228 // to grow the heap without causing GCs (if possible). | 12229 // to grow the heap without causing GCs (if possible). |
12229 COUNTERS->gc_last_resort_from_js()->Increment(); | 12230 isolate->counters()->gc_last_resort_from_js()->Increment(); |
12230 HEAP->CollectAllGarbage(false); | 12231 isolate->heap()->CollectAllGarbage(false); |
12231 } | 12232 } |
12232 } | 12233 } |
12233 | 12234 |
12234 | 12235 |
12235 } } // namespace v8::internal | 12236 } } // namespace v8::internal |
OLD | NEW |