| Index: src/code-stubs.cc
|
| ===================================================================
|
| --- src/code-stubs.cc (revision 3132)
|
| +++ src/code-stubs.cc (working copy)
|
| @@ -36,28 +36,11 @@
|
| namespace internal {
|
|
|
| Handle<Code> CodeStub::GetCode() {
|
| - bool custom_cache = has_custom_cache();
|
| + uint32_t key = GetKey();
|
| + int index = Heap::code_stubs()->FindEntry(key);
|
| + if (index == NumberDictionary::kNotFound) {
|
| + HandleScope scope;
|
|
|
| - int index = 0;
|
| - uint32_t key = 0;
|
| - if (custom_cache) {
|
| - Code* cached;
|
| - if (GetCustomCache(&cached)) {
|
| - return Handle<Code>(cached);
|
| - } else {
|
| - index = NumberDictionary::kNotFound;
|
| - }
|
| - } else {
|
| - key = GetKey();
|
| - index = Heap::code_stubs()->FindEntry(key);
|
| - if (index != NumberDictionary::kNotFound)
|
| - return Handle<Code>(Code::cast(Heap::code_stubs()->ValueAt(index)));
|
| - }
|
| -
|
| - Code* result;
|
| - {
|
| - v8::HandleScope scope;
|
| -
|
| // Update the static counter each time a new code stub is generated.
|
| Counters::code_stubs.Increment();
|
|
|
| @@ -96,21 +79,18 @@
|
| }
|
| #endif
|
|
|
| - if (custom_cache) {
|
| - SetCustomCache(*code);
|
| - } else {
|
| - // Update the dictionary and the root in Heap.
|
| - Handle<NumberDictionary> dict =
|
| - Factory::DictionaryAtNumberPut(
|
| - Handle<NumberDictionary>(Heap::code_stubs()),
|
| - key,
|
| - code);
|
| - Heap::public_set_code_stubs(*dict);
|
| - }
|
| - result = *code;
|
| + // Update the dictionary and the root in Heap.
|
| + Handle<NumberDictionary> dict =
|
| + Factory::DictionaryAtNumberPut(
|
| + Handle<NumberDictionary>(Heap::code_stubs()),
|
| + key,
|
| + code);
|
| + Heap::public_set_code_stubs(*dict);
|
| + index = Heap::code_stubs()->FindEntry(key);
|
| }
|
| + ASSERT(index != NumberDictionary::kNotFound);
|
|
|
| - return Handle<Code>(result);
|
| + return Handle<Code>(Code::cast(Heap::code_stubs()->ValueAt(index)));
|
| }
|
|
|
|
|
|
|