| Index: src/objects.cc
|
| diff --git a/src/objects.cc b/src/objects.cc
|
| index 317af43fc7fa592852339c61086c218ac36dddbb..a34d8df9939fef480f43acb19baa20fc0f04baf7 100644
|
| --- a/src/objects.cc
|
| +++ b/src/objects.cc
|
| @@ -9521,22 +9521,26 @@ void SharedFunctionInfo::AddToOptimizedCodeMap(
|
| Handle<SharedFunctionInfo> shared,
|
| Handle<Context> native_context,
|
| Handle<Code> code,
|
| - Handle<FixedArray> literals) {
|
| + Handle<FixedArray> literals,
|
| + BailoutId osr_ast_id) {
|
| CALL_HEAP_FUNCTION_VOID(
|
| shared->GetIsolate(),
|
| - shared->AddToOptimizedCodeMap(*native_context, *code, *literals));
|
| + shared->AddToOptimizedCodeMap(
|
| + *native_context, *code, *literals, osr_ast_id));
|
| }
|
|
|
|
|
| MaybeObject* SharedFunctionInfo::AddToOptimizedCodeMap(Context* native_context,
|
| Code* code,
|
| - FixedArray* literals) {
|
| + FixedArray* literals,
|
| + BailoutId osr_ast_id) {
|
| ASSERT(code->kind() == Code::OPTIMIZED_FUNCTION);
|
| ASSERT(native_context->IsNativeContext());
|
| - STATIC_ASSERT(kEntryLength == 3);
|
| + STATIC_ASSERT(kEntryLength == 4);
|
| Heap* heap = GetHeap();
|
| FixedArray* new_code_map;
|
| Object* value = optimized_code_map();
|
| + Smi* osr_ast_id_smi = Smi::FromInt(osr_ast_id.ToInt());
|
| if (value->IsSmi()) {
|
| // No optimized code map.
|
| ASSERT_EQ(0, Smi::cast(value)->value());
|
| @@ -9546,10 +9550,11 @@ MaybeObject* SharedFunctionInfo::AddToOptimizedCodeMap(Context* native_context,
|
| new_code_map->set(kEntriesStart + 0, native_context);
|
| new_code_map->set(kEntriesStart + 1, code);
|
| new_code_map->set(kEntriesStart + 2, literals);
|
| + new_code_map->set(kEntriesStart + 3, osr_ast_id_smi);
|
| } else {
|
| // Copy old map and append one new entry.
|
| FixedArray* old_code_map = FixedArray::cast(value);
|
| - ASSERT_EQ(-1, SearchOptimizedCodeMap(native_context));
|
| + ASSERT_EQ(-1, SearchOptimizedCodeMap(native_context, osr_ast_id));
|
| int old_length = old_code_map->length();
|
| int new_length = old_length + kEntryLength;
|
| MaybeObject* maybe = old_code_map->CopySize(new_length);
|
| @@ -9557,6 +9562,7 @@ MaybeObject* SharedFunctionInfo::AddToOptimizedCodeMap(Context* native_context,
|
| new_code_map->set(old_length + 0, native_context);
|
| new_code_map->set(old_length + 1, code);
|
| new_code_map->set(old_length + 2, literals);
|
| + new_code_map->set(old_length + 3, osr_ast_id_smi);
|
| // Zap the old map for the sake of the heap verifier.
|
| if (Heap::ShouldZapGarbage()) {
|
| Object** data = old_code_map->data_start();
|
| @@ -9570,6 +9576,7 @@ MaybeObject* SharedFunctionInfo::AddToOptimizedCodeMap(Context* native_context,
|
| ASSERT(Code::cast(new_code_map->get(i + 1))->kind() ==
|
| Code::OPTIMIZED_FUNCTION);
|
| ASSERT(new_code_map->get(i + 2)->IsFixedArray());
|
| + ASSERT(new_code_map->get(i + 3)->IsSmi());
|
| }
|
| #endif
|
| set_optimized_code_map(new_code_map);
|
| @@ -9589,7 +9596,6 @@ FixedArray* SharedFunctionInfo::GetLiteralsFromOptimizedCodeMap(int index) {
|
| }
|
|
|
|
|
| -
|
| Code* SharedFunctionInfo::GetCodeFromOptimizedCodeMap(int index) {
|
| ASSERT(index > kEntriesStart);
|
| FixedArray* code_map = FixedArray::cast(optimized_code_map());
|
| @@ -9637,6 +9643,7 @@ void SharedFunctionInfo::EvictFromOptimizedCodeMap(Code* optimized_code,
|
| code_map->set(i, code_map->get(i + kEntryLength));
|
| code_map->set(i + 1, code_map->get(i + 1 + kEntryLength));
|
| code_map->set(i + 2, code_map->get(i + 2 + kEntryLength));
|
| + code_map->set(i + 3, code_map->get(i + 3 + kEntryLength));
|
| i += kEntryLength;
|
| }
|
| if (removed_entry) {
|
| @@ -10198,15 +10205,18 @@ void SharedFunctionInfo::CompleteInobjectSlackTracking() {
|
| }
|
|
|
|
|
| -int SharedFunctionInfo::SearchOptimizedCodeMap(Context* native_context) {
|
| +int SharedFunctionInfo::SearchOptimizedCodeMap(Context* native_context,
|
| + BailoutId osr_ast_id) {
|
| ASSERT(native_context->IsNativeContext());
|
| if (!FLAG_cache_optimized_code) return -1;
|
| Object* value = optimized_code_map();
|
| if (!value->IsSmi()) {
|
| FixedArray* optimized_code_map = FixedArray::cast(value);
|
| int length = optimized_code_map->length();
|
| + Smi* osr_ast_id_smi = Smi::FromInt(osr_ast_id.ToInt());
|
| for (int i = kEntriesStart; i < length; i += kEntryLength) {
|
| - if (optimized_code_map->get(i) == native_context) {
|
| + if (optimized_code_map->get(i) == native_context &&
|
| + optimized_code_map->get(i + 3) == osr_ast_id_smi) {
|
| return i + 1;
|
| }
|
| }
|
|
|