Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: src/hydrogen.cc

Issue 98673003: Fix HInnerAllocatedObject to use an HValue for the offset. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2230 2230
2231 HConstant* empty_fixed_array = 2231 HConstant* empty_fixed_array =
2232 Add<HConstant>(isolate()->factory()->empty_fixed_array()); 2232 Add<HConstant>(isolate()->factory()->empty_fixed_array());
2233 2233
2234 HObjectAccess access = HObjectAccess::ForPropertiesPointer(); 2234 HObjectAccess access = HObjectAccess::ForPropertiesPointer();
2235 Add<HStoreNamedField>(array, access, empty_fixed_array); 2235 Add<HStoreNamedField>(array, access, empty_fixed_array);
2236 Add<HStoreNamedField>(array, HObjectAccess::ForArrayLength(elements_kind), 2236 Add<HStoreNamedField>(array, HObjectAccess::ForArrayLength(elements_kind),
2237 length_field); 2237 length_field);
2238 2238
2239 if (mode == TRACK_ALLOCATION_SITE) { 2239 if (mode == TRACK_ALLOCATION_SITE) {
2240 BuildCreateAllocationMemento(array, 2240 BuildCreateAllocationMemento(
2241 JSArray::kSize, 2241 array, Add<HConstant>(JSArray::kSize), allocation_site_payload);
2242 allocation_site_payload);
2243 if (FLAG_allocation_site_pretenuring) {
2244 // TODO(mvstanton): move this code into BuildCreateAllocationMemento when
2245 // constructed arrays also pay attention to pretenuring.
2246 HObjectAccess access =
2247 HObjectAccess::ForAllocationSiteOffset(
2248 AllocationSite::kMementoCreateCountOffset);
2249 HValue* create_info = Add<HLoadNamedField>(allocation_site_payload,
2250 access);
2251 HInstruction* new_create_info =
2252 AddUncasted<HAdd>(create_info, graph()->GetConstant1());
2253 new_create_info->ClearFlag(HValue::kCanOverflow);
2254 HStoreNamedField* store = Add<HStoreNamedField>(allocation_site_payload,
2255 access, new_create_info);
2256 // No write barrier needed to store a smi.
2257 store->SkipWriteBarrier();
2258 }
2259 } 2242 }
2260 2243
2261 int elements_location = JSArray::kSize; 2244 int elements_location = JSArray::kSize;
2262 if (mode == TRACK_ALLOCATION_SITE) { 2245 if (mode == TRACK_ALLOCATION_SITE) {
2263 elements_location += AllocationMemento::kSize; 2246 elements_location += AllocationMemento::kSize;
2264 } 2247 }
2265 2248
2266 HValue* elements = Add<HInnerAllocatedObject>(array, elements_location); 2249 HInnerAllocatedObject* elements = Add<HInnerAllocatedObject>(
2250 array, Add<HConstant>(elements_location));
2267 Add<HStoreNamedField>(array, HObjectAccess::ForElementsPointer(), elements); 2251 Add<HStoreNamedField>(array, HObjectAccess::ForElementsPointer(), elements);
2268 return static_cast<HInnerAllocatedObject*>(elements); 2252 return elements;
2269 } 2253 }
2270 2254
2271 2255
2272 HInstruction* HGraphBuilder::AddElementAccess( 2256 HInstruction* HGraphBuilder::AddElementAccess(
2273 HValue* elements, 2257 HValue* elements,
2274 HValue* checked_key, 2258 HValue* checked_key,
2275 HValue* val, 2259 HValue* val,
2276 HValue* dependency, 2260 HValue* dependency,
2277 ElementsKind elements_kind, 2261 ElementsKind elements_kind,
2278 bool is_store, 2262 bool is_store,
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2488 for (int i = 0; i < JSArray::kSize; i += kPointerSize) { 2472 for (int i = 0; i < JSArray::kSize; i += kPointerSize) {
2489 if ((i != JSArray::kElementsOffset) || (length == 0)) { 2473 if ((i != JSArray::kElementsOffset) || (length == 0)) {
2490 HObjectAccess access = HObjectAccess::ForJSArrayOffset(i); 2474 HObjectAccess access = HObjectAccess::ForJSArrayOffset(i);
2491 Add<HStoreNamedField>(object, access, 2475 Add<HStoreNamedField>(object, access,
2492 Add<HLoadNamedField>(boilerplate, access)); 2476 Add<HLoadNamedField>(boilerplate, access));
2493 } 2477 }
2494 } 2478 }
2495 2479
2496 // Create an allocation site info if requested. 2480 // Create an allocation site info if requested.
2497 if (mode == TRACK_ALLOCATION_SITE) { 2481 if (mode == TRACK_ALLOCATION_SITE) {
2498 BuildCreateAllocationMemento(object, JSArray::kSize, allocation_site); 2482 BuildCreateAllocationMemento(
2483 object, Add<HConstant>(JSArray::kSize), allocation_site);
2499 } 2484 }
2500 2485
2501 if (length > 0) { 2486 if (length > 0) {
2502 HValue* boilerplate_elements = AddLoadElements(boilerplate); 2487 HValue* boilerplate_elements = AddLoadElements(boilerplate);
2503 HValue* object_elements; 2488 HValue* object_elements;
2504 if (IsFastDoubleElementsKind(kind)) { 2489 if (IsFastDoubleElementsKind(kind)) {
2505 HValue* elems_size = Add<HConstant>(FixedDoubleArray::SizeFor(length)); 2490 HValue* elems_size = Add<HConstant>(FixedDoubleArray::SizeFor(length));
2506 object_elements = Add<HAllocate>(elems_size, HType::JSArray(), 2491 object_elements = Add<HAllocate>(elems_size, HType::JSArray(),
2507 NOT_TENURED, FIXED_DOUBLE_ARRAY_TYPE); 2492 NOT_TENURED, FIXED_DOUBLE_ARRAY_TYPE);
2508 } else { 2493 } else {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
2581 BuildCheckMap(value, type->Classes().Current()); 2566 BuildCheckMap(value, type->Classes().Current());
2582 } else { 2567 } else {
2583 if_nil.Deopt("Too many undetectable types"); 2568 if_nil.Deopt("Too many undetectable types");
2584 } 2569 }
2585 } 2570 }
2586 2571
2587 if_nil.CaptureContinuation(continuation); 2572 if_nil.CaptureContinuation(continuation);
2588 } 2573 }
2589 2574
2590 2575
2591 HValue* HGraphBuilder::BuildCreateAllocationMemento(HValue* previous_object, 2576 void HGraphBuilder::BuildCreateAllocationMemento(
2592 int previous_object_size, 2577 HValue* previous_object,
2593 HValue* alloc_site) { 2578 HValue* previous_object_size,
2594 ASSERT(alloc_site != NULL); 2579 HValue* allocation_site) {
2595 HInnerAllocatedObject* alloc_memento = Add<HInnerAllocatedObject>( 2580 ASSERT(allocation_site != NULL);
2581 HInnerAllocatedObject* allocation_memento = Add<HInnerAllocatedObject>(
2596 previous_object, previous_object_size); 2582 previous_object, previous_object_size);
2597 Handle<Map> alloc_memento_map = 2583 AddStoreMapConstant(
2598 isolate()->factory()->allocation_memento_map(); 2584 allocation_memento, isolate()->factory()->allocation_memento_map());
2599 AddStoreMapConstant(alloc_memento, alloc_memento_map); 2585 Add<HStoreNamedField>(
2600 HObjectAccess access = HObjectAccess::ForAllocationMementoSite(); 2586 allocation_memento,
2601 Add<HStoreNamedField>(alloc_memento, access, alloc_site); 2587 HObjectAccess::ForAllocationMementoSite(),
2602 return alloc_memento; 2588 allocation_site);
2589 if (FLAG_allocation_site_pretenuring) {
2590 HValue* memento_create_count = Add<HLoadNamedField>(
2591 allocation_site, HObjectAccess::ForAllocationSiteOffset(
2592 AllocationSite::kMementoCreateCountOffset));
2593 memento_create_count = AddUncasted<HAdd>(
2594 memento_create_count, graph()->GetConstant1());
2595 HStoreNamedField* store = Add<HStoreNamedField>(
2596 allocation_site, HObjectAccess::ForAllocationSiteOffset(
2597 AllocationSite::kMementoCreateCountOffset), memento_create_count);
2598 // No write barrier needed to store a smi.
2599 store->SkipWriteBarrier();
2600 }
2603 } 2601 }
2604 2602
2605 2603
2606 HInstruction* HGraphBuilder::BuildGetNativeContext() { 2604 HInstruction* HGraphBuilder::BuildGetNativeContext() {
2607 // Get the global context, then the native context 2605 // Get the global context, then the native context
2608 HInstruction* global_object = Add<HGlobalObject>(); 2606 HInstruction* global_object = Add<HGlobalObject>();
2609 HObjectAccess access = HObjectAccess::ForJSObjectOffset( 2607 HObjectAccess access = HObjectAccess::ForJSObjectOffset(
2610 GlobalObject::kNativeContextOffset); 2608 GlobalObject::kNativeContextOffset);
2611 return Add<HLoadNamedField>(global_object, access); 2609 return Add<HLoadNamedField>(global_object, access);
2612 } 2610 }
(...skipping 8195 matching lines...) Expand 10 before | Expand all | Expand 10 after
10808 if (ShouldProduceTraceOutput()) { 10806 if (ShouldProduceTraceOutput()) {
10809 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 10807 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
10810 } 10808 }
10811 10809
10812 #ifdef DEBUG 10810 #ifdef DEBUG
10813 graph_->Verify(false); // No full verify. 10811 graph_->Verify(false); // No full verify.
10814 #endif 10812 #endif
10815 } 10813 }
10816 10814
10817 } } // namespace v8::internal 10815 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698