| Index: src/objects.cc
|
| diff --git a/src/objects.cc b/src/objects.cc
|
| index f96fd83849cff3090814484757f26b352932bc87..64a89a6dd3e2d67c32b3a5178be05be41cb149a5 100644
|
| --- a/src/objects.cc
|
| +++ b/src/objects.cc
|
| @@ -9543,16 +9543,19 @@ 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);
|
| @@ -9571,7 +9574,7 @@ MaybeObject* SharedFunctionInfo::AddToOptimizedCodeMap(Context* native_context,
|
| } 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);
|
| @@ -10258,7 +10261,8 @@ 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();
|
| @@ -10267,7 +10271,8 @@ int SharedFunctionInfo::SearchOptimizedCodeMap(Context* native_context) {
|
| int length = optimized_code_map->length();
|
| for (int i = kEntriesStart; i < length; i += kEntryLength) {
|
| if (optimized_code_map->get(i) == native_context) {
|
| - return i + 1;
|
| + Code* code = Code::cast(optimized_code_map->get(i + 1));
|
| + if (code->OsrAstId() == osr_ast_id) return i + 1;
|
| }
|
| }
|
| if (FLAG_trace_opt) {
|
| @@ -10693,6 +10698,14 @@ BailoutId Code::TranslatePcOffsetToAstId(uint32_t pc_offset) {
|
| }
|
|
|
|
|
| +BailoutId Code::OsrAstId() {
|
| + ASSERT(kind() == Code::OPTIMIZED_FUNCTION);
|
| + DeoptimizationInputData* data =
|
| + DeoptimizationInputData::cast(deoptimization_data());
|
| + return BailoutId(data->OsrAstId()->value());
|
| +}
|
| +
|
| +
|
| void Code::MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate) {
|
| PatchPlatformCodeAge(isolate, sequence, kNoAgeCodeAge, NO_MARKING_PARITY);
|
| }
|
|
|