OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 2980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2991 case Translation::GETTER_STUB_FRAME: | 2991 case Translation::GETTER_STUB_FRAME: |
2992 case Translation::SETTER_STUB_FRAME: | 2992 case Translation::SETTER_STUB_FRAME: |
2993 // Peeled off before getting here. | 2993 // Peeled off before getting here. |
2994 break; | 2994 break; |
2995 | 2995 |
2996 case Translation::DUPLICATED_OBJECT: { | 2996 case Translation::DUPLICATED_OBJECT: { |
2997 return SlotRef::NewDuplicateObject(iterator->Next()); | 2997 return SlotRef::NewDuplicateObject(iterator->Next()); |
2998 } | 2998 } |
2999 | 2999 |
3000 case Translation::ARGUMENTS_OBJECT: | 3000 case Translation::ARGUMENTS_OBJECT: |
3001 // This can be only emitted for local slots not for argument slots. | 3001 return SlotRef::NewArgumentsObject(iterator->Next()); |
3002 break; | |
3003 | 3002 |
3004 case Translation::CAPTURED_OBJECT: { | 3003 case Translation::CAPTURED_OBJECT: { |
3005 return SlotRef::NewDeferredObject(iterator->Next()); | 3004 return SlotRef::NewDeferredObject(iterator->Next()); |
3006 } | 3005 } |
3007 | 3006 |
3008 case Translation::REGISTER: | 3007 case Translation::REGISTER: |
3009 case Translation::INT32_REGISTER: | 3008 case Translation::INT32_REGISTER: |
3010 case Translation::UINT32_REGISTER: | 3009 case Translation::UINT32_REGISTER: |
3011 case Translation::DOUBLE_REGISTER: | 3010 case Translation::DOUBLE_REGISTER: |
3012 // We are at safepoint which corresponds to call. All registers are | 3011 // We are at safepoint which corresponds to call. All registers are |
(...skipping 29 matching lines...) Expand all Loading... | |
3042 int literal_index = iterator->Next(); | 3041 int literal_index = iterator->Next(); |
3043 return SlotRef(data->GetIsolate(), | 3042 return SlotRef(data->GetIsolate(), |
3044 data->LiteralArray()->get(literal_index)); | 3043 data->LiteralArray()->get(literal_index)); |
3045 } | 3044 } |
3046 | 3045 |
3047 case Translation::COMPILED_STUB_FRAME: | 3046 case Translation::COMPILED_STUB_FRAME: |
3048 UNREACHABLE(); | 3047 UNREACHABLE(); |
3049 break; | 3048 break; |
3050 } | 3049 } |
3051 | 3050 |
3052 UNREACHABLE(); | 3051 CHECK(false); // We should never get here |
Michael Starzinger
2014/02/27 14:37:40
nit: Let's use FATAL() with a short message instea
| |
3053 return SlotRef(); | 3052 return SlotRef(); |
3054 } | 3053 } |
3055 | 3054 |
3056 | 3055 |
3057 SlotRefValueBuilder::SlotRefValueBuilder(JavaScriptFrame* frame, | 3056 SlotRefValueBuilder::SlotRefValueBuilder(JavaScriptFrame* frame, |
3058 int inlined_jsframe_index, | 3057 int inlined_jsframe_index, |
3059 int formal_parameter_count) | 3058 int formal_parameter_count) |
3060 : current_slot_(0), args_length_(-1), first_slot_index_(-1) { | 3059 : current_slot_(0), args_length_(-1), first_slot_index_(-1) { |
3061 DisallowHeapAllocation no_gc; | 3060 DisallowHeapAllocation no_gc; |
3062 | 3061 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3122 opcode != Translation::GETTER_STUB_FRAME && | 3121 opcode != Translation::GETTER_STUB_FRAME && |
3123 opcode != Translation::SETTER_STUB_FRAME && | 3122 opcode != Translation::SETTER_STUB_FRAME && |
3124 opcode != Translation::COMPILED_STUB_FRAME) { | 3123 opcode != Translation::COMPILED_STUB_FRAME) { |
3125 slot_refs_.Add(ComputeSlotForNextArgument(opcode, &it, data, frame)); | 3124 slot_refs_.Add(ComputeSlotForNextArgument(opcode, &it, data, frame)); |
3126 | 3125 |
3127 if (first_slot_index_ >= 0) { | 3126 if (first_slot_index_ >= 0) { |
3128 // We have found the beginning of our frame -> make sure we count | 3127 // We have found the beginning of our frame -> make sure we count |
3129 // the nested slots of captured objects | 3128 // the nested slots of captured objects |
3130 number_of_slots--; | 3129 number_of_slots--; |
3131 SlotRef& slot = slot_refs_.last(); | 3130 SlotRef& slot = slot_refs_.last(); |
3132 if (slot.Representation() == SlotRef::DEFERRED_OBJECT) { | 3131 ASSERT(slot.Representation() != SlotRef::ARGUMENTS_OBJECT); |
3133 number_of_slots += slot.DeferredObjectLength(); | 3132 number_of_slots += slot.GetChildrenCount(); |
3134 } | |
3135 if (slot.Representation() == SlotRef::DEFERRED_OBJECT || | 3133 if (slot.Representation() == SlotRef::DEFERRED_OBJECT || |
3136 slot.Representation() == SlotRef::DUPLICATE_OBJECT) { | 3134 slot.Representation() == SlotRef::DUPLICATE_OBJECT) { |
3137 should_deopt = true; | 3135 should_deopt = true; |
3138 } | 3136 } |
3139 } | 3137 } |
3140 | 3138 |
3141 processed = true; | 3139 processed = true; |
3142 } | 3140 } |
3143 if (!processed) { | 3141 if (!processed) { |
3144 // Skip over operands to advance to the next opcode. | 3142 // Skip over operands to advance to the next opcode. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3178 | 3176 |
3179 case DOUBLE: { | 3177 case DOUBLE: { |
3180 double value = read_double_value(addr_); | 3178 double value = read_double_value(addr_); |
3181 return isolate->factory()->NewNumber(value); | 3179 return isolate->factory()->NewNumber(value); |
3182 } | 3180 } |
3183 | 3181 |
3184 case LITERAL: | 3182 case LITERAL: |
3185 return literal_; | 3183 return literal_; |
3186 | 3184 |
3187 default: | 3185 default: |
3188 UNREACHABLE(); | 3186 CHECK(false); // We should never get here |
Michael Starzinger
2014/02/27 14:37:40
nit: Likewise.
| |
3189 return Handle<Object>::null(); | 3187 return Handle<Object>::null(); |
3190 } | 3188 } |
3191 } | 3189 } |
3192 | 3190 |
3193 | 3191 |
3194 void SlotRefValueBuilder::Prepare(Isolate* isolate) { | 3192 void SlotRefValueBuilder::Prepare(Isolate* isolate) { |
3195 MaterializedObjectStore* materialized_store = | 3193 MaterializedObjectStore* materialized_store = |
3196 isolate->materialized_object_store(); | 3194 isolate->materialized_object_store(); |
3197 previously_materialized_objects_ = materialized_store->Get(stack_frame_id_); | 3195 previously_materialized_objects_ = materialized_store->Get(stack_frame_id_); |
3198 prev_materialized_count_ = previously_materialized_objects_.is_null() | 3196 prev_materialized_count_ = previously_materialized_objects_.is_null() |
3199 ? 0 : previously_materialized_objects_->length(); | 3197 ? 0 : previously_materialized_objects_->length(); |
3200 | 3198 |
3201 // Skip any materialized objects of the inlined "parent" frames. | 3199 // Skip any materialized objects of the inlined "parent" frames. |
3202 // (Note that we still need to materialize them because they might be | 3200 // (Note that we still need to materialize them because they might be |
3203 // referred to as duplicated objects.) | 3201 // referred to as duplicated objects.) |
3204 while (current_slot_ < first_slot_index_) { | 3202 while (current_slot_ < first_slot_index_) { |
3205 GetNext(isolate, 0); | 3203 GetNext(isolate, 0); |
3206 } | 3204 } |
3207 ASSERT(current_slot_ == first_slot_index_); | 3205 ASSERT(current_slot_ == first_slot_index_); |
3208 } | 3206 } |
3209 | 3207 |
3210 | 3208 |
3211 Handle<Object> SlotRefValueBuilder::GetPreviouslyMaterialized( | 3209 Handle<Object> SlotRefValueBuilder::GetPreviouslyMaterialized( |
3212 Isolate* isolate, int length) { | 3210 Isolate* isolate, int length) { |
3213 int object_index = materialized_objects_.length(); | 3211 int object_index = materialized_objects_.length(); |
3214 Handle<Object> return_value = Handle<Object>( | 3212 Handle<Object> return_value = Handle<Object>( |
3215 previously_materialized_objects_->get(object_index), isolate); | 3213 previously_materialized_objects_->get(object_index), isolate); |
3216 materialized_objects_.Add(return_value); | 3214 materialized_objects_.Add(return_value); |
3217 | 3215 |
3218 // Now need to skip all nested objects (and possibly read them from | 3216 // Now need to skip all the nested objects (and possibly read them from |
3219 // the materialization store, too) | 3217 // the materialization store, too). |
3220 for (int i = 0; i < length; i++) { | 3218 for (int i = 0; i < length; i++) { |
3221 SlotRef& slot = slot_refs_[current_slot_]; | 3219 SlotRef& slot = slot_refs_[current_slot_]; |
3222 current_slot_++; | 3220 current_slot_++; |
3223 | 3221 |
3224 // For nested deferred objects, we need to read its properties | 3222 // We need to read all the nested objects - add them to the |
3225 if (slot.Representation() == SlotRef::DEFERRED_OBJECT) { | 3223 // number of objects we need to process. |
3226 length += slot.DeferredObjectLength(); | 3224 length += slot.GetChildrenCount(); |
3227 } | |
3228 | 3225 |
3229 // For nested deferred and duplicate objects, we need to put them into | 3226 // Put the nested deferred/duplicate objects into our materialization |
3230 // our materialization array | 3227 // array. |
3231 if (slot.Representation() == SlotRef::DEFERRED_OBJECT || | 3228 if (slot.Representation() == SlotRef::DEFERRED_OBJECT || |
3232 slot.Representation() == SlotRef::DUPLICATE_OBJECT) { | 3229 slot.Representation() == SlotRef::DUPLICATE_OBJECT) { |
3233 int nested_object_index = materialized_objects_.length(); | 3230 int nested_object_index = materialized_objects_.length(); |
3234 Handle<Object> nested_object = Handle<Object>( | 3231 Handle<Object> nested_object = Handle<Object>( |
3235 previously_materialized_objects_->get(nested_object_index), | 3232 previously_materialized_objects_->get(nested_object_index), |
3236 isolate); | 3233 isolate); |
3237 materialized_objects_.Add(nested_object); | 3234 materialized_objects_.Add(nested_object); |
3238 } | 3235 } |
3239 } | 3236 } |
3240 | 3237 |
3241 return return_value; | 3238 return return_value; |
3242 } | 3239 } |
3243 | 3240 |
3244 | 3241 |
3245 Handle<Object> SlotRefValueBuilder::GetNext(Isolate* isolate, int lvl) { | 3242 Handle<Object> SlotRefValueBuilder::GetNext(Isolate* isolate, int lvl) { |
3246 SlotRef& slot = slot_refs_[current_slot_]; | 3243 SlotRef& slot = slot_refs_[current_slot_]; |
3247 current_slot_++; | 3244 current_slot_++; |
3248 switch (slot.Representation()) { | 3245 switch (slot.Representation()) { |
3249 case SlotRef::TAGGED: | 3246 case SlotRef::TAGGED: |
3250 case SlotRef::INT32: | 3247 case SlotRef::INT32: |
3251 case SlotRef::UINT32: | 3248 case SlotRef::UINT32: |
3252 case SlotRef::DOUBLE: | 3249 case SlotRef::DOUBLE: |
3253 case SlotRef::LITERAL: { | 3250 case SlotRef::LITERAL: { |
3254 return slot.GetValue(isolate); | 3251 return slot.GetValue(isolate); |
3255 } | 3252 } |
3253 case SlotRef::ARGUMENTS_OBJECT: { | |
3254 // We should never need to materialize an arguments object, | |
3255 // but we still need to put something into the array | |
3256 // so that the indexing is consistent. | |
3257 Handle<Object> undefined(isolate->heap()->undefined_value(), isolate); | |
Michael Starzinger
2014/02/27 14:37:40
nit: Use isolate->factory()->undefined_value() ins
| |
3258 materialized_objects_.Add(undefined); | |
3259 int length = slot.GetChildrenCount(); | |
3260 for (int i = 0; i < length; ++i) { | |
3261 // We don't need the argument, just ignore it | |
3262 GetNext(isolate, lvl + 1); | |
3263 } | |
3264 return undefined; | |
3265 } | |
3256 case SlotRef::DEFERRED_OBJECT: { | 3266 case SlotRef::DEFERRED_OBJECT: { |
3257 int length = slot.DeferredObjectLength(); | 3267 int length = slot.GetChildrenCount(); |
3258 ASSERT(slot_refs_[current_slot_].Representation() == SlotRef::LITERAL || | 3268 ASSERT(slot_refs_[current_slot_].Representation() == SlotRef::LITERAL || |
3259 slot_refs_[current_slot_].Representation() == SlotRef::TAGGED); | 3269 slot_refs_[current_slot_].Representation() == SlotRef::TAGGED); |
3260 | 3270 |
3261 int object_index = materialized_objects_.length(); | 3271 int object_index = materialized_objects_.length(); |
3262 if (object_index < prev_materialized_count_) { | 3272 if (object_index < prev_materialized_count_) { |
3263 return GetPreviouslyMaterialized(isolate, length); | 3273 return GetPreviouslyMaterialized(isolate, length); |
3264 } | 3274 } |
3265 | 3275 |
3266 Handle<Object> map_object = slot_refs_[current_slot_].GetValue(isolate); | 3276 Handle<Object> map_object = slot_refs_[current_slot_].GetValue(isolate); |
3267 Handle<Map> map = Map::GeneralizeAllFieldRepresentations( | 3277 Handle<Map> map = Map::GeneralizeAllFieldRepresentations( |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3316 int object_index = slot.DuplicateObjectId(); | 3326 int object_index = slot.DuplicateObjectId(); |
3317 Handle<Object> object = materialized_objects_[object_index]; | 3327 Handle<Object> object = materialized_objects_[object_index]; |
3318 materialized_objects_.Add(object); | 3328 materialized_objects_.Add(object); |
3319 return object; | 3329 return object; |
3320 } | 3330 } |
3321 default: | 3331 default: |
3322 UNREACHABLE(); | 3332 UNREACHABLE(); |
3323 break; | 3333 break; |
3324 } | 3334 } |
3325 | 3335 |
3326 UNREACHABLE(); | 3336 CHECK(false); // We should never get here |
Michael Starzinger
2014/02/27 14:37:40
nit: Likewise.
| |
3327 return Handle<Object>::null(); | 3337 return Handle<Object>::null(); |
3328 } | 3338 } |
3329 | 3339 |
3330 | 3340 |
3331 void SlotRefValueBuilder::Finish(Isolate* isolate) { | 3341 void SlotRefValueBuilder::Finish(Isolate* isolate) { |
3332 // We should have processed all slot | 3342 // We should have processed all slot |
3333 ASSERT(slot_refs_.length() == current_slot_); | 3343 ASSERT(slot_refs_.length() == current_slot_); |
3334 | 3344 |
3335 if (materialized_objects_.length() > prev_materialized_count_) { | 3345 if (materialized_objects_.length() > prev_materialized_count_) { |
3336 // We have materialized some new objects, so we have to store them | 3346 // We have materialized some new objects, so we have to store them |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3463 | 3473 |
3464 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 3474 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
3465 v->VisitPointer(BitCast<Object**>(&function_)); | 3475 v->VisitPointer(BitCast<Object**>(&function_)); |
3466 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 3476 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
3467 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 3477 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
3468 } | 3478 } |
3469 | 3479 |
3470 #endif // ENABLE_DEBUGGER_SUPPORT | 3480 #endif // ENABLE_DEBUGGER_SUPPORT |
3471 | 3481 |
3472 } } // namespace v8::internal | 3482 } } // namespace v8::internal |
OLD | NEW |