OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 10670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10681 | 10681 |
10682 #undef F | 10682 #undef F |
10683 | 10683 |
10684 | 10684 |
10685 Runtime::Function* Runtime::FunctionForId(FunctionId fid) { | 10685 Runtime::Function* Runtime::FunctionForId(FunctionId fid) { |
10686 ASSERT(0 <= fid && fid < kNofFunctions); | 10686 ASSERT(0 <= fid && fid < kNofFunctions); |
10687 return &Runtime_functions[fid]; | 10687 return &Runtime_functions[fid]; |
10688 } | 10688 } |
10689 | 10689 |
10690 | 10690 |
10691 Runtime::Function* Runtime::FunctionForName(const char* name) { | 10691 Runtime::Function* Runtime::FunctionForName(Vector<const char> name) { |
10692 for (Function* f = Runtime_functions; f->name != NULL; f++) { | 10692 for (Function* f = Runtime_functions; f->name != NULL; f++) { |
10693 if (strcmp(f->name, name) == 0) { | 10693 if (strncmp(f->name, name.start(), name.length()) == 0 |
| 10694 && f->name[name.length()] == 0) { |
10694 return f; | 10695 return f; |
10695 } | 10696 } |
10696 } | 10697 } |
10697 return NULL; | 10698 return NULL; |
10698 } | 10699 } |
10699 | 10700 |
10700 | 10701 |
10701 void Runtime::PerformGC(Object* result) { | 10702 void Runtime::PerformGC(Object* result) { |
10702 Failure* failure = Failure::cast(result); | 10703 Failure* failure = Failure::cast(result); |
10703 if (failure->IsRetryAfterGC()) { | 10704 if (failure->IsRetryAfterGC()) { |
10704 // Try to do a garbage collection; ignore it if it fails. The C | 10705 // Try to do a garbage collection; ignore it if it fails. The C |
10705 // entry stub will throw an out-of-memory exception in that case. | 10706 // entry stub will throw an out-of-memory exception in that case. |
10706 Heap::CollectGarbage(failure->requested(), failure->allocation_space()); | 10707 Heap::CollectGarbage(failure->requested(), failure->allocation_space()); |
10707 } else { | 10708 } else { |
10708 // Handle last resort GC and make sure to allow future allocations | 10709 // Handle last resort GC and make sure to allow future allocations |
10709 // to grow the heap without causing GCs (if possible). | 10710 // to grow the heap without causing GCs (if possible). |
10710 Counters::gc_last_resort_from_js.Increment(); | 10711 Counters::gc_last_resort_from_js.Increment(); |
10711 Heap::CollectAllGarbage(false); | 10712 Heap::CollectAllGarbage(false); |
10712 } | 10713 } |
10713 } | 10714 } |
10714 | 10715 |
10715 | 10716 |
10716 } } // namespace v8::internal | 10717 } } // namespace v8::internal |
OLD | NEW |