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 8358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8369 Handle<JSObject> original_boilerplate_object, | 8369 Handle<JSObject> original_boilerplate_object, |
8370 Handle<Object> allocation_site, | 8370 Handle<Object> allocation_site, |
8371 int data_size, | 8371 int data_size, |
8372 int pointer_size, | 8372 int pointer_size, |
8373 AllocationSiteMode mode) { | 8373 AllocationSiteMode mode) { |
8374 NoObservableSideEffectsScope no_effects(this); | 8374 NoObservableSideEffectsScope no_effects(this); |
8375 | 8375 |
8376 HInstruction* target = NULL; | 8376 HInstruction* target = NULL; |
8377 HInstruction* data_target = NULL; | 8377 HInstruction* data_target = NULL; |
8378 | 8378 |
8379 HAllocate::Flags flags = HAllocate::DefaultFlags(); | 8379 ElementsKind kind = boilerplate_object->map()->elements_kind(); |
8380 | 8380 |
8381 if (isolate()->heap()->ShouldGloballyPretenure()) { | 8381 if (isolate()->heap()->ShouldGloballyPretenure()) { |
8382 if (data_size != 0) { | 8382 if (data_size != 0) { |
8383 HAllocate::Flags data_flags = | 8383 HAllocate::Flags data_flags = |
8384 static_cast<HAllocate::Flags>(HAllocate::DefaultFlags() | | 8384 static_cast<HAllocate::Flags>(HAllocate::DefaultFlags(kind) | |
8385 HAllocate::CAN_ALLOCATE_IN_OLD_DATA_SPACE); | 8385 HAllocate::CAN_ALLOCATE_IN_OLD_DATA_SPACE); |
8386 HValue* size_in_bytes = Add<HConstant>(data_size); | 8386 HValue* size_in_bytes = Add<HConstant>(data_size); |
8387 data_target = Add<HAllocate>(context, size_in_bytes, | 8387 data_target = Add<HAllocate>(context, size_in_bytes, HType::JSObject(), |
8388 HType::JSObject(), data_flags); | 8388 data_flags); |
8389 Handle<Map> free_space_map = isolate()->factory()->free_space_map(); | 8389 Handle<Map> free_space_map = isolate()->factory()->free_space_map(); |
8390 AddStoreMapConstant(data_target, free_space_map); | 8390 AddStoreMapConstant(data_target, free_space_map); |
8391 HObjectAccess access = | 8391 HObjectAccess access = |
8392 HObjectAccess::ForJSObjectOffset(FreeSpace::kSizeOffset); | 8392 HObjectAccess::ForJSObjectOffset(FreeSpace::kSizeOffset); |
8393 AddStore(data_target, access, size_in_bytes); | 8393 AddStore(data_target, access, size_in_bytes); |
8394 } | 8394 } |
8395 if (pointer_size != 0) { | 8395 if (pointer_size != 0) { |
8396 flags = static_cast<HAllocate::Flags>( | 8396 HAllocate::Flags pointer_flags = |
8397 flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE); | 8397 static_cast<HAllocate::Flags>(HAllocate::DefaultFlags() | |
| 8398 HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE); |
8398 HValue* size_in_bytes = Add<HConstant>(pointer_size); | 8399 HValue* size_in_bytes = Add<HConstant>(pointer_size); |
8399 target = Add<HAllocate>(context, size_in_bytes, HType::JSObject(), flags); | 8400 target = Add<HAllocate>(context, size_in_bytes, HType::JSObject(), |
| 8401 pointer_flags); |
8400 } | 8402 } |
8401 } else { | 8403 } else { |
| 8404 HAllocate::Flags flags = HAllocate::DefaultFlags(kind); |
8402 HValue* size_in_bytes = Add<HConstant>(data_size + pointer_size); | 8405 HValue* size_in_bytes = Add<HConstant>(data_size + pointer_size); |
8403 target = Add<HAllocate>(context, size_in_bytes, HType::JSObject(), flags); | 8406 target = Add<HAllocate>(context, size_in_bytes, HType::JSObject(), flags); |
8404 } | 8407 } |
8405 | 8408 |
8406 int offset = 0; | 8409 int offset = 0; |
8407 int data_offset = 0; | 8410 int data_offset = 0; |
8408 BuildEmitDeepCopy(boilerplate_object, original_boilerplate_object, | 8411 BuildEmitDeepCopy(boilerplate_object, original_boilerplate_object, |
8409 allocation_site, target, &offset, data_target, | 8412 allocation_site, target, &offset, data_target, |
8410 &data_offset, mode); | 8413 &data_offset, mode); |
8411 return target; | 8414 return target; |
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9989 if (ShouldProduceTraceOutput()) { | 9992 if (ShouldProduceTraceOutput()) { |
9990 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9993 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
9991 } | 9994 } |
9992 | 9995 |
9993 #ifdef DEBUG | 9996 #ifdef DEBUG |
9994 graph_->Verify(false); // No full verify. | 9997 graph_->Verify(false); // No full verify. |
9995 #endif | 9998 #endif |
9996 } | 9999 } |
9997 | 10000 |
9998 } } // namespace v8::internal | 10001 } } // namespace v8::internal |
OLD | NEW |