| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2284 } else { | 2284 } else { |
| 2285 stream->Add(" push "); | 2285 stream->Add(" push "); |
| 2286 } | 2286 } |
| 2287 values_[i]->PrintNameTo(stream); | 2287 values_[i]->PrintNameTo(stream); |
| 2288 if (i > 0) stream->Add(","); | 2288 if (i > 0) stream->Add(","); |
| 2289 } | 2289 } |
| 2290 } | 2290 } |
| 2291 } | 2291 } |
| 2292 | 2292 |
| 2293 | 2293 |
| 2294 void HSimulate::ReplayEnvironment(HEnvironment* env) { |
| 2295 ASSERT(env != NULL); |
| 2296 env->set_ast_id(ast_id()); |
| 2297 env->Drop(pop_count()); |
| 2298 for (int i = values()->length() - 1; i >= 0; --i) { |
| 2299 HValue* value = values()->at(i); |
| 2300 if (HasAssignedIndexAt(i)) { |
| 2301 env->Bind(GetAssignedIndexAt(i), value); |
| 2302 } else { |
| 2303 env->Push(value); |
| 2304 } |
| 2305 } |
| 2306 } |
| 2307 |
| 2308 |
| 2309 // Replay captured objects by replacing all captured objects with the |
| 2310 // same capture id in the current and all outer environments. |
| 2311 void HCapturedObject::ReplayEnvironment(HEnvironment* env) { |
| 2312 ASSERT(env != NULL); |
| 2313 while (env != NULL) { |
| 2314 for (int i = 0; i < env->length(); ++i) { |
| 2315 HValue* value = env->values()->at(i); |
| 2316 if (value->IsCapturedObject() && |
| 2317 HCapturedObject::cast(value)->capture_id() == this->capture_id()) { |
| 2318 env->SetValueAt(i, this); |
| 2319 } |
| 2320 } |
| 2321 env = env->outer(); |
| 2322 } |
| 2323 } |
| 2324 |
| 2325 |
| 2294 void HEnterInlined::RegisterReturnTarget(HBasicBlock* return_target, | 2326 void HEnterInlined::RegisterReturnTarget(HBasicBlock* return_target, |
| 2295 Zone* zone) { | 2327 Zone* zone) { |
| 2296 ASSERT(return_target->IsInlineReturnTarget()); | 2328 ASSERT(return_target->IsInlineReturnTarget()); |
| 2297 return_targets_.Add(return_target, zone); | 2329 return_targets_.Add(return_target, zone); |
| 2298 } | 2330 } |
| 2299 | 2331 |
| 2300 | 2332 |
| 2301 void HEnterInlined::PrintDataTo(StringStream* stream) { | 2333 void HEnterInlined::PrintDataTo(StringStream* stream) { |
| 2302 SmartArrayPointer<char> name = function()->debug_name()->ToCString(); | 2334 SmartArrayPointer<char> name = function()->debug_name()->ToCString(); |
| 2303 stream->Add("%s, id=%d", *name, function()->id().ToInt()); | 2335 stream->Add("%s, id=%d", *name, function()->id().ToInt()); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2361 is_internalized_string_(is_internalize_string), | 2393 is_internalized_string_(is_internalize_string), |
| 2362 is_not_in_new_space_(is_not_in_new_space), | 2394 is_not_in_new_space_(is_not_in_new_space), |
| 2363 is_cell_(is_cell), | 2395 is_cell_(is_cell), |
| 2364 boolean_value_(boolean_value) { | 2396 boolean_value_(boolean_value) { |
| 2365 ASSERT(!handle.is_null()); | 2397 ASSERT(!handle.is_null()); |
| 2366 ASSERT(!type.IsTaggedNumber()); | 2398 ASSERT(!type.IsTaggedNumber()); |
| 2367 Initialize(r); | 2399 Initialize(r); |
| 2368 } | 2400 } |
| 2369 | 2401 |
| 2370 | 2402 |
| 2403 HConstant::HConstant(Handle<Map> handle, |
| 2404 UniqueValueId unique_id) |
| 2405 : HTemplateInstruction<0>(HType::Tagged()), |
| 2406 handle_(handle), |
| 2407 unique_id_(unique_id), |
| 2408 has_smi_value_(false), |
| 2409 has_int32_value_(false), |
| 2410 has_double_value_(false), |
| 2411 has_external_reference_value_(false), |
| 2412 is_internalized_string_(false), |
| 2413 is_not_in_new_space_(true), |
| 2414 is_cell_(false), |
| 2415 boolean_value_(false) { |
| 2416 ASSERT(!handle.is_null()); |
| 2417 Initialize(Representation::Tagged()); |
| 2418 } |
| 2419 |
| 2420 |
| 2371 HConstant::HConstant(int32_t integer_value, | 2421 HConstant::HConstant(int32_t integer_value, |
| 2372 Representation r, | 2422 Representation r, |
| 2373 bool is_not_in_new_space, | 2423 bool is_not_in_new_space, |
| 2374 Handle<Object> optional_handle) | 2424 Handle<Object> optional_handle) |
| 2375 : handle_(optional_handle), | 2425 : handle_(optional_handle), |
| 2376 unique_id_(), | 2426 unique_id_(), |
| 2377 has_smi_value_(Smi::IsValid(integer_value)), | 2427 has_smi_value_(Smi::IsValid(integer_value)), |
| 2378 has_int32_value_(true), | 2428 has_int32_value_(true), |
| 2379 has_double_value_(true), | 2429 has_double_value_(true), |
| 2380 has_external_reference_value_(false), | 2430 has_external_reference_value_(false), |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2844 | 2894 |
| 2845 | 2895 |
| 2846 void HParameter::PrintDataTo(StringStream* stream) { | 2896 void HParameter::PrintDataTo(StringStream* stream) { |
| 2847 stream->Add("%u", index()); | 2897 stream->Add("%u", index()); |
| 2848 } | 2898 } |
| 2849 | 2899 |
| 2850 | 2900 |
| 2851 void HLoadNamedField::PrintDataTo(StringStream* stream) { | 2901 void HLoadNamedField::PrintDataTo(StringStream* stream) { |
| 2852 object()->PrintNameTo(stream); | 2902 object()->PrintNameTo(stream); |
| 2853 access_.PrintTo(stream); | 2903 access_.PrintTo(stream); |
| 2854 if (HasTypeCheck()) { | |
| 2855 stream->Add(" "); | |
| 2856 typecheck()->PrintNameTo(stream); | |
| 2857 } | |
| 2858 } | 2904 } |
| 2859 | 2905 |
| 2860 | 2906 |
| 2861 HCheckMaps* HCheckMaps::New(Zone* zone, | 2907 HCheckMaps* HCheckMaps::New(Zone* zone, |
| 2862 HValue* context, | 2908 HValue* context, |
| 2863 HValue* value, | 2909 HValue* value, |
| 2864 Handle<Map> map, | 2910 Handle<Map> map, |
| 2865 CompilationInfo* info, | 2911 CompilationInfo* info, |
| 2866 HValue* typecheck) { | 2912 HValue* typecheck) { |
| 2867 HCheckMaps* check_map = new(zone) HCheckMaps(value, zone, typecheck); | 2913 HCheckMaps* check_map = new(zone) HCheckMaps(value, zone, typecheck); |
| 2868 check_map->Add(map, zone); | 2914 check_map->Add(map, zone); |
| 2869 if (map->CanOmitMapChecks() && | 2915 if (map->CanOmitMapChecks() && |
| 2870 value->IsConstant() && | 2916 value->IsConstant() && |
| 2871 HConstant::cast(value)->InstanceOf(map)) { | 2917 HConstant::cast(value)->HasMap(map)) { |
| 2872 check_map->omit(info); | 2918 check_map->omit(info); |
| 2873 } | 2919 } |
| 2874 return check_map; | 2920 return check_map; |
| 2875 } | 2921 } |
| 2876 | 2922 |
| 2877 | 2923 |
| 2878 void HCheckMaps::FinalizeUniqueValueId() { | 2924 void HCheckMaps::FinalizeUniqueValueId() { |
| 2879 if (!map_unique_ids_.is_empty()) return; | 2925 if (!map_unique_ids_.is_empty()) return; |
| 2880 Zone* zone = block()->zone(); | 2926 Zone* zone = block()->zone(); |
| 2881 map_unique_ids_.Initialize(map_set_.length(), zone); | 2927 map_unique_ids_.Initialize(map_set_.length(), zone); |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3179 if (!input_rep.IsTagged()) { | 3225 if (!input_rep.IsTagged()) { |
| 3180 rep = rep.generalize(input_rep); | 3226 rep = rep.generalize(input_rep); |
| 3181 } | 3227 } |
| 3182 return rep; | 3228 return rep; |
| 3183 } | 3229 } |
| 3184 | 3230 |
| 3185 | 3231 |
| 3186 void HAllocate::HandleSideEffectDominator(GVNFlag side_effect, | 3232 void HAllocate::HandleSideEffectDominator(GVNFlag side_effect, |
| 3187 HValue* dominator) { | 3233 HValue* dominator) { |
| 3188 ASSERT(side_effect == kChangesNewSpacePromotion); | 3234 ASSERT(side_effect == kChangesNewSpacePromotion); |
| 3235 Zone* zone = block()->zone(); |
| 3189 if (!FLAG_use_allocation_folding) return; | 3236 if (!FLAG_use_allocation_folding) return; |
| 3190 | 3237 |
| 3191 // Try to fold allocations together with their dominating allocations. | 3238 // Try to fold allocations together with their dominating allocations. |
| 3192 if (!dominator->IsAllocate()) { | 3239 if (!dominator->IsAllocate()) { |
| 3193 if (FLAG_trace_allocation_folding) { | 3240 if (FLAG_trace_allocation_folding) { |
| 3194 PrintF("#%d (%s) cannot fold into #%d (%s)\n", | 3241 PrintF("#%d (%s) cannot fold into #%d (%s)\n", |
| 3195 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); | 3242 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); |
| 3196 } | 3243 } |
| 3197 return; | 3244 return; |
| 3198 } | 3245 } |
| 3199 | 3246 |
| 3200 HAllocate* dominator_allocate_instr = HAllocate::cast(dominator); | 3247 HAllocate* dominator_allocate = HAllocate::cast(dominator); |
| 3201 HValue* dominator_size = dominator_allocate_instr->size(); | 3248 HValue* dominator_size = dominator_allocate->size(); |
| 3202 HValue* current_size = size(); | 3249 HValue* current_size = size(); |
| 3203 // We can just fold allocations that are guaranteed in new space. | 3250 |
| 3204 // TODO(hpayer): Add support for non-constant allocation in dominator. | 3251 // TODO(hpayer): Add support for non-constant allocation in dominator. |
| 3205 if (!IsNewSpaceAllocation() || !current_size->IsInteger32Constant() || | 3252 if (!current_size->IsInteger32Constant() || |
| 3206 !dominator_allocate_instr->IsNewSpaceAllocation() || | |
| 3207 !dominator_size->IsInteger32Constant()) { | 3253 !dominator_size->IsInteger32Constant()) { |
| 3208 if (FLAG_trace_allocation_folding) { | 3254 if (FLAG_trace_allocation_folding) { |
| 3209 PrintF("#%d (%s) cannot fold into #%d (%s)\n", | 3255 PrintF("#%d (%s) cannot fold into #%d (%s), dynamic allocation size\n", |
| 3210 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); | 3256 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); |
| 3211 } | 3257 } |
| 3212 return; | 3258 return; |
| 3213 } | 3259 } |
| 3214 | 3260 |
| 3261 dominator_allocate = GetFoldableDominator(dominator_allocate); |
| 3262 if (dominator_allocate == NULL) { |
| 3263 return; |
| 3264 } |
| 3265 |
| 3266 ASSERT((IsNewSpaceAllocation() && |
| 3267 dominator_allocate->IsNewSpaceAllocation()) || |
| 3268 (IsOldDataSpaceAllocation() && |
| 3269 dominator_allocate->IsOldDataSpaceAllocation()) || |
| 3270 (IsOldPointerSpaceAllocation() && |
| 3271 dominator_allocate->IsOldPointerSpaceAllocation())); |
| 3272 |
| 3215 // First update the size of the dominator allocate instruction. | 3273 // First update the size of the dominator allocate instruction. |
| 3274 dominator_size = dominator_allocate->size(); |
| 3216 int32_t dominator_size_constant = | 3275 int32_t dominator_size_constant = |
| 3217 HConstant::cast(dominator_size)->GetInteger32Constant(); | 3276 HConstant::cast(dominator_size)->GetInteger32Constant(); |
| 3218 int32_t current_size_constant = | 3277 int32_t current_size_constant = |
| 3219 HConstant::cast(current_size)->GetInteger32Constant(); | 3278 HConstant::cast(current_size)->GetInteger32Constant(); |
| 3220 int32_t new_dominator_size = dominator_size_constant + current_size_constant; | 3279 int32_t new_dominator_size = dominator_size_constant + current_size_constant; |
| 3221 | 3280 |
| 3222 if (MustAllocateDoubleAligned()) { | 3281 if (MustAllocateDoubleAligned()) { |
| 3223 if (!dominator_allocate_instr->MustAllocateDoubleAligned()) { | 3282 if (!dominator_allocate->MustAllocateDoubleAligned()) { |
| 3224 dominator_allocate_instr->MakeDoubleAligned(); | 3283 dominator_allocate->MakeDoubleAligned(); |
| 3225 } | 3284 } |
| 3226 if ((dominator_size_constant & kDoubleAlignmentMask) != 0) { | 3285 if ((dominator_size_constant & kDoubleAlignmentMask) != 0) { |
| 3227 dominator_size_constant += kDoubleSize / 2; | 3286 dominator_size_constant += kDoubleSize / 2; |
| 3228 new_dominator_size += kDoubleSize / 2; | 3287 new_dominator_size += kDoubleSize / 2; |
| 3229 } | 3288 } |
| 3230 } | 3289 } |
| 3231 | 3290 |
| 3232 if (new_dominator_size > Page::kMaxNonCodeHeapObjectSize) { | 3291 if (new_dominator_size > Page::kMaxNonCodeHeapObjectSize) { |
| 3233 if (FLAG_trace_allocation_folding) { | 3292 if (FLAG_trace_allocation_folding) { |
| 3234 PrintF("#%d (%s) cannot fold into #%d (%s) due to size: %d\n", | 3293 PrintF("#%d (%s) cannot fold into #%d (%s) due to size: %d\n", |
| 3235 id(), Mnemonic(), dominator->id(), dominator->Mnemonic(), | 3294 id(), Mnemonic(), dominator_allocate->id(), |
| 3236 new_dominator_size); | 3295 dominator_allocate->Mnemonic(), new_dominator_size); |
| 3237 } | 3296 } |
| 3238 return; | 3297 return; |
| 3239 } | 3298 } |
| 3240 HBasicBlock* block = dominator->block(); | 3299 |
| 3241 Zone* zone = block->zone(); | 3300 HInstruction* new_dominator_size_constant = HConstant::CreateAndInsertBefore( |
| 3242 HInstruction* new_dominator_size_constant = | 3301 zone, |
| 3243 HConstant::New(zone, context(), new_dominator_size); | 3302 context(), |
| 3244 new_dominator_size_constant->InsertBefore(dominator_allocate_instr); | 3303 new_dominator_size, |
| 3245 dominator_allocate_instr->UpdateSize(new_dominator_size_constant); | 3304 Representation::None(), |
| 3305 dominator_allocate); |
| 3306 dominator_allocate->UpdateSize(new_dominator_size_constant); |
| 3246 | 3307 |
| 3247 #ifdef VERIFY_HEAP | 3308 #ifdef VERIFY_HEAP |
| 3248 if (FLAG_verify_heap) { | 3309 if (FLAG_verify_heap && dominator_allocate->IsNewSpaceAllocation()) { |
| 3249 dominator_allocate_instr->MakePrefillWithFiller(); | 3310 dominator_allocate->MakePrefillWithFiller(); |
| 3250 } | 3311 } |
| 3251 #endif | 3312 #endif |
| 3252 | 3313 |
| 3253 // After that replace the dominated allocate instruction. | 3314 // After that replace the dominated allocate instruction. |
| 3254 HInstruction* dominated_allocate_instr = | 3315 HInstruction* dominated_allocate_instr = |
| 3255 HInnerAllocatedObject::New(zone, | 3316 HInnerAllocatedObject::New(zone, |
| 3256 context(), | 3317 context(), |
| 3257 dominator_allocate_instr, | 3318 dominator_allocate, |
| 3258 dominator_size_constant, | 3319 dominator_size_constant, |
| 3259 type()); | 3320 type()); |
| 3260 dominated_allocate_instr->InsertBefore(this); | 3321 dominated_allocate_instr->InsertBefore(this); |
| 3261 DeleteAndReplaceWith(dominated_allocate_instr); | 3322 DeleteAndReplaceWith(dominated_allocate_instr); |
| 3262 if (FLAG_trace_allocation_folding) { | 3323 if (FLAG_trace_allocation_folding) { |
| 3263 PrintF("#%d (%s) folded into #%d (%s)\n", | 3324 PrintF("#%d (%s) folded into #%d (%s)\n", |
| 3264 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); | 3325 id(), Mnemonic(), dominator_allocate->id(), |
| 3326 dominator_allocate->Mnemonic()); |
| 3265 } | 3327 } |
| 3266 } | 3328 } |
| 3267 | 3329 |
| 3268 | 3330 |
| 3331 HAllocate* HAllocate::GetFoldableDominator(HAllocate* dominator) { |
| 3332 if (!IsFoldable(dominator)) { |
| 3333 // We cannot hoist old space allocations over new space allocations. |
| 3334 if (IsNewSpaceAllocation() || dominator->IsNewSpaceAllocation()) { |
| 3335 if (FLAG_trace_allocation_folding) { |
| 3336 PrintF("#%d (%s) cannot fold into #%d (%s), new space hoisting\n", |
| 3337 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); |
| 3338 } |
| 3339 return NULL; |
| 3340 } |
| 3341 |
| 3342 HAllocate* dominator_dominator = dominator->dominating_allocate_; |
| 3343 |
| 3344 // We can hoist old data space allocations over an old pointer space |
| 3345 // allocation and vice versa. For that we have to check the dominator |
| 3346 // of the dominator allocate instruction. |
| 3347 if (dominator_dominator == NULL) { |
| 3348 dominating_allocate_ = dominator; |
| 3349 if (FLAG_trace_allocation_folding) { |
| 3350 PrintF("#%d (%s) cannot fold into #%d (%s), different spaces\n", |
| 3351 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); |
| 3352 } |
| 3353 return NULL; |
| 3354 } |
| 3355 |
| 3356 // We can just fold old space allocations that are in the same basic block, |
| 3357 // since it is not guaranteed that we fill up the whole allocated old |
| 3358 // space memory. |
| 3359 // TODO(hpayer): Remove this limitation and add filler maps for each each |
| 3360 // allocation as soon as we have store elimination. |
| 3361 if (block()->block_id() != dominator_dominator->block()->block_id()) { |
| 3362 if (FLAG_trace_allocation_folding) { |
| 3363 PrintF("#%d (%s) cannot fold into #%d (%s), different basic blocks\n", |
| 3364 id(), Mnemonic(), dominator_dominator->id(), |
| 3365 dominator_dominator->Mnemonic()); |
| 3366 } |
| 3367 return NULL; |
| 3368 } |
| 3369 |
| 3370 ASSERT((IsOldDataSpaceAllocation() && |
| 3371 dominator_dominator->IsOldDataSpaceAllocation()) || |
| 3372 (IsOldPointerSpaceAllocation() && |
| 3373 dominator_dominator->IsOldPointerSpaceAllocation())); |
| 3374 |
| 3375 int32_t current_size = HConstant::cast(size())->GetInteger32Constant(); |
| 3376 HStoreNamedField* dominator_free_space_size = |
| 3377 dominator->filler_free_space_size_; |
| 3378 if (dominator_free_space_size != NULL) { |
| 3379 // We already hoisted one old space allocation, i.e., we already installed |
| 3380 // a filler map. Hence, we just have to update the free space size. |
| 3381 dominator->UpdateFreeSpaceFiller(current_size); |
| 3382 } else { |
| 3383 // This is the first old space allocation that gets hoisted. We have to |
| 3384 // install a filler map since the follwing allocation may cause a GC. |
| 3385 dominator->CreateFreeSpaceFiller(current_size); |
| 3386 } |
| 3387 |
| 3388 // We can hoist the old space allocation over the actual dominator. |
| 3389 return dominator_dominator; |
| 3390 } |
| 3391 return dominator; |
| 3392 } |
| 3393 |
| 3394 |
| 3395 void HAllocate::UpdateFreeSpaceFiller(int32_t free_space_size) { |
| 3396 ASSERT(filler_free_space_size_ != NULL); |
| 3397 Zone* zone = block()->zone(); |
| 3398 // We must explicitly force Smi representation here because on x64 we |
| 3399 // would otherwise automatically choose int32, but the actual store |
| 3400 // requires a Smi-tagged value. |
| 3401 HConstant* new_free_space_size = HConstant::CreateAndInsertBefore( |
| 3402 zone, |
| 3403 context(), |
| 3404 filler_free_space_size_->value()->GetInteger32Constant() + |
| 3405 free_space_size, |
| 3406 Representation::Smi(), |
| 3407 filler_free_space_size_); |
| 3408 filler_free_space_size_->UpdateValue(new_free_space_size); |
| 3409 } |
| 3410 |
| 3411 |
| 3412 void HAllocate::CreateFreeSpaceFiller(int32_t free_space_size) { |
| 3413 ASSERT(filler_free_space_size_ == NULL); |
| 3414 Zone* zone = block()->zone(); |
| 3415 int32_t dominator_size = |
| 3416 HConstant::cast(dominating_allocate_->size())->GetInteger32Constant(); |
| 3417 HInstruction* free_space_instr = |
| 3418 HInnerAllocatedObject::New(zone, context(), dominating_allocate_, |
| 3419 dominator_size, type()); |
| 3420 free_space_instr->InsertBefore(this); |
| 3421 HConstant* filler_map = HConstant::New( |
| 3422 zone, |
| 3423 context(), |
| 3424 isolate()->factory()->free_space_map(), |
| 3425 UniqueValueId(isolate()->heap()->free_space_map())); |
| 3426 filler_map->InsertAfter(free_space_instr); |
| 3427 HInstruction* store_map = HStoreNamedField::New(zone, context(), |
| 3428 free_space_instr, HObjectAccess::ForMap(), filler_map); |
| 3429 store_map->SetFlag(HValue::kHasNoObservableSideEffects); |
| 3430 store_map->InsertAfter(filler_map); |
| 3431 |
| 3432 // We must explicitly force Smi representation here because on x64 we |
| 3433 // would otherwise automatically choose int32, but the actual store |
| 3434 // requires a Smi-tagged value. |
| 3435 HConstant* filler_size = HConstant::CreateAndInsertAfter( |
| 3436 zone, context(), free_space_size, Representation::Smi(), store_map); |
| 3437 // Must force Smi representation for x64 (see comment above). |
| 3438 HObjectAccess access = |
| 3439 HObjectAccess::ForJSObjectOffset(FreeSpace::kSizeOffset, |
| 3440 Representation::Smi()); |
| 3441 HStoreNamedField* store_size = HStoreNamedField::New(zone, context(), |
| 3442 free_space_instr, access, filler_size); |
| 3443 store_size->SetFlag(HValue::kHasNoObservableSideEffects); |
| 3444 store_size->InsertAfter(filler_size); |
| 3445 filler_free_space_size_ = store_size; |
| 3446 } |
| 3447 |
| 3448 |
| 3269 void HAllocate::PrintDataTo(StringStream* stream) { | 3449 void HAllocate::PrintDataTo(StringStream* stream) { |
| 3270 size()->PrintNameTo(stream); | 3450 size()->PrintNameTo(stream); |
| 3271 stream->Add(" ("); | 3451 stream->Add(" ("); |
| 3272 if (IsNewSpaceAllocation()) stream->Add("N"); | 3452 if (IsNewSpaceAllocation()) stream->Add("N"); |
| 3273 if (IsOldPointerSpaceAllocation()) stream->Add("P"); | 3453 if (IsOldPointerSpaceAllocation()) stream->Add("P"); |
| 3274 if (IsOldDataSpaceAllocation()) stream->Add("D"); | 3454 if (IsOldDataSpaceAllocation()) stream->Add("D"); |
| 3275 if (MustAllocateDoubleAligned()) stream->Add("A"); | 3455 if (MustAllocateDoubleAligned()) stream->Add("A"); |
| 3276 if (MustPrefillWithFiller()) stream->Add("F"); | 3456 if (MustPrefillWithFiller()) stream->Add("F"); |
| 3277 stream->Add(")"); | 3457 stream->Add(")"); |
| 3278 } | 3458 } |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3860 | 4040 |
| 3861 if (offset == JSObject::kElementsOffset) { | 4041 if (offset == JSObject::kElementsOffset) { |
| 3862 portion = kElementsPointer; | 4042 portion = kElementsPointer; |
| 3863 } else if (offset == JSObject::kMapOffset) { | 4043 } else if (offset == JSObject::kMapOffset) { |
| 3864 portion = kMaps; | 4044 portion = kMaps; |
| 3865 } | 4045 } |
| 3866 return HObjectAccess(portion, offset, representation); | 4046 return HObjectAccess(portion, offset, representation); |
| 3867 } | 4047 } |
| 3868 | 4048 |
| 3869 | 4049 |
| 4050 HObjectAccess HObjectAccess::ForContextSlot(int index) { |
| 4051 ASSERT(index >= 0); |
| 4052 Portion portion = kInobject; |
| 4053 int offset = Context::kHeaderSize + index * kPointerSize; |
| 4054 ASSERT_EQ(offset, Context::SlotOffset(index) + kHeapObjectTag); |
| 4055 return HObjectAccess(portion, offset, Representation::Tagged()); |
| 4056 } |
| 4057 |
| 4058 |
| 3870 HObjectAccess HObjectAccess::ForJSArrayOffset(int offset) { | 4059 HObjectAccess HObjectAccess::ForJSArrayOffset(int offset) { |
| 3871 ASSERT(offset >= 0); | 4060 ASSERT(offset >= 0); |
| 3872 Portion portion = kInobject; | 4061 Portion portion = kInobject; |
| 3873 | 4062 |
| 3874 if (offset == JSObject::kElementsOffset) { | 4063 if (offset == JSObject::kElementsOffset) { |
| 3875 portion = kElementsPointer; | 4064 portion = kElementsPointer; |
| 3876 } else if (offset == JSArray::kLengthOffset) { | 4065 } else if (offset == JSArray::kLengthOffset) { |
| 3877 portion = kArrayLengths; | 4066 portion = kArrayLengths; |
| 3878 } else if (offset == JSObject::kMapOffset) { | 4067 } else if (offset == JSObject::kMapOffset) { |
| 3879 portion = kMaps; | 4068 portion = kMaps; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4000 break; | 4189 break; |
| 4001 case kExternalMemory: | 4190 case kExternalMemory: |
| 4002 stream->Add("[external-memory]"); | 4191 stream->Add("[external-memory]"); |
| 4003 break; | 4192 break; |
| 4004 } | 4193 } |
| 4005 | 4194 |
| 4006 stream->Add("@%d", offset()); | 4195 stream->Add("@%d", offset()); |
| 4007 } | 4196 } |
| 4008 | 4197 |
| 4009 } } // namespace v8::internal | 4198 } } // namespace v8::internal |
| OLD | NEW |