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

Side by Side Diff: src/objects.cc

Issue 153913002: A64: Synchronize with r16756. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months 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/objects.h ('k') | src/objects-debug.cc » ('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 4461 matching lines...) Expand 10 before | Expand all | Expand 10 after
4472 4472
4473 4473
4474 void NormalizedMapCache::Clear() { 4474 void NormalizedMapCache::Clear() {
4475 int entries = length(); 4475 int entries = length();
4476 for (int i = 0; i != entries; i++) { 4476 for (int i = 0; i != entries; i++) {
4477 set_undefined(i); 4477 set_undefined(i);
4478 } 4478 }
4479 } 4479 }
4480 4480
4481 4481
4482 void JSObject::UpdateMapCodeCache(Handle<JSObject> object, 4482 void HeapObject::UpdateMapCodeCache(Handle<HeapObject> object,
4483 Handle<Name> name, 4483 Handle<Name> name,
4484 Handle<Code> code) { 4484 Handle<Code> code) {
4485 Handle<Map> map(object->map()); 4485 Handle<Map> map(object->map());
4486 if (map->is_shared()) { 4486 if (map->is_shared()) {
4487 Handle<JSObject> receiver = Handle<JSObject>::cast(object);
4487 // Fast case maps are never marked as shared. 4488 // Fast case maps are never marked as shared.
4488 ASSERT(!object->HasFastProperties()); 4489 ASSERT(!receiver->HasFastProperties());
4489 // Replace the map with an identical copy that can be safely modified. 4490 // Replace the map with an identical copy that can be safely modified.
4490 map = Map::CopyNormalized(map, KEEP_INOBJECT_PROPERTIES, 4491 map = Map::CopyNormalized(map, KEEP_INOBJECT_PROPERTIES,
4491 UNIQUE_NORMALIZED_MAP); 4492 UNIQUE_NORMALIZED_MAP);
4492 object->GetIsolate()->counters()->normalized_maps()->Increment(); 4493 receiver->GetIsolate()->counters()->normalized_maps()->Increment();
4493 object->set_map(*map); 4494 receiver->set_map(*map);
4494 } 4495 }
4495 Map::UpdateCodeCache(map, name, code); 4496 Map::UpdateCodeCache(map, name, code);
4496 } 4497 }
4497 4498
4498 4499
4499 void JSObject::NormalizeProperties(Handle<JSObject> object, 4500 void JSObject::NormalizeProperties(Handle<JSObject> object,
4500 PropertyNormalizationMode mode, 4501 PropertyNormalizationMode mode,
4501 int expected_additional_properties) { 4502 int expected_additional_properties) {
4502 CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), 4503 CALL_HEAP_FUNCTION_VOID(object->GetIsolate(),
4503 object->NormalizeProperties( 4504 object->NormalizeProperties(
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
5627 MaybeObject* maybe_copy = map()->Copy(); 5628 MaybeObject* maybe_copy = map()->Copy();
5628 if (!maybe_copy->To(&new_map)) return maybe_copy; 5629 if (!maybe_copy->To(&new_map)) return maybe_copy;
5629 new_map->set_is_observed(true); 5630 new_map->set_is_observed(true);
5630 } 5631 }
5631 set_map(new_map); 5632 set_map(new_map);
5632 5633
5633 return heap->undefined_value(); 5634 return heap->undefined_value();
5634 } 5635 }
5635 5636
5636 5637
5637 MUST_USE_RESULT MaybeObject* JSObject::DeepCopy(Isolate* isolate) { 5638 // TODO(mstarzinger): Temporary wrapper until handlified.
5639 static Handle<Object> NewStorageFor(Isolate* isolate,
5640 Handle<Object> object,
5641 Representation representation) {
5642 Heap* heap = isolate->heap();
5643 CALL_HEAP_FUNCTION(isolate,
5644 object->AllocateNewStorageFor(heap, representation),
5645 Object);
5646 }
5647
5648
5649 Handle<JSObject> JSObject::Copy(Handle<JSObject> object) {
5650 Isolate* isolate = object->GetIsolate();
5651 CALL_HEAP_FUNCTION(isolate,
5652 isolate->heap()->CopyJSObject(*object), JSObject);
5653 }
5654
5655
5656 Handle<JSObject> JSObject::DeepCopy(Handle<JSObject> object) {
5657 Isolate* isolate = object->GetIsolate();
5638 StackLimitCheck check(isolate); 5658 StackLimitCheck check(isolate);
5639 if (check.HasOverflowed()) return isolate->StackOverflow(); 5659 if (check.HasOverflowed()) {
5640 5660 isolate->StackOverflow();
5641 if (map()->is_deprecated()) { 5661 return Handle<JSObject>::null();
5642 MaybeObject* maybe_failure = MigrateInstance();
5643 if (maybe_failure->IsFailure()) return maybe_failure;
5644 } 5662 }
5645 5663
5646 Heap* heap = isolate->heap(); 5664 if (object->map()->is_deprecated()) {
5647 Object* result; 5665 MigrateInstance(object);
5648 { MaybeObject* maybe_result = heap->CopyJSObject(this);
5649 if (!maybe_result->ToObject(&result)) return maybe_result;
5650 } 5666 }
5651 JSObject* copy = JSObject::cast(result); 5667
5668 Handle<JSObject> copy = Copy(object);
5652 5669
5653 // Deep copy local properties. 5670 // Deep copy local properties.
5654 if (copy->HasFastProperties()) { 5671 if (copy->HasFastProperties()) {
5655 DescriptorArray* descriptors = copy->map()->instance_descriptors(); 5672 Handle<DescriptorArray> descriptors(copy->map()->instance_descriptors());
5656 int limit = copy->map()->NumberOfOwnDescriptors(); 5673 int limit = copy->map()->NumberOfOwnDescriptors();
5657 for (int i = 0; i < limit; i++) { 5674 for (int i = 0; i < limit; i++) {
5658 PropertyDetails details = descriptors->GetDetails(i); 5675 PropertyDetails details = descriptors->GetDetails(i);
5659 if (details.type() != FIELD) continue; 5676 if (details.type() != FIELD) continue;
5660 int index = descriptors->GetFieldIndex(i); 5677 int index = descriptors->GetFieldIndex(i);
5661 Object* value = RawFastPropertyAt(index); 5678 Handle<Object> value(object->RawFastPropertyAt(index), isolate);
5662 if (value->IsJSObject()) { 5679 if (value->IsJSObject()) {
5663 JSObject* js_object = JSObject::cast(value); 5680 value = DeepCopy(Handle<JSObject>::cast(value));
5664 MaybeObject* maybe_copy = js_object->DeepCopy(isolate); 5681 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, value, Handle<JSObject>());
5665 if (!maybe_copy->To(&value)) return maybe_copy;
5666 } else { 5682 } else {
5667 Representation representation = details.representation(); 5683 Representation representation = details.representation();
5668 MaybeObject* maybe_storage = 5684 value = NewStorageFor(isolate, value, representation);
5669 value->AllocateNewStorageFor(heap, representation);
5670 if (!maybe_storage->To(&value)) return maybe_storage;
5671 } 5685 }
5672 copy->FastPropertyAtPut(index, value); 5686 copy->FastPropertyAtPut(index, *value);
5673 } 5687 }
5674 } else { 5688 } else {
5675 { MaybeObject* maybe_result = 5689 Handle<FixedArray> names =
5676 heap->AllocateFixedArray(copy->NumberOfLocalProperties()); 5690 isolate->factory()->NewFixedArray(copy->NumberOfLocalProperties());
5677 if (!maybe_result->ToObject(&result)) return maybe_result; 5691 copy->GetLocalPropertyNames(*names, 0);
5678 }
5679 FixedArray* names = FixedArray::cast(result);
5680 copy->GetLocalPropertyNames(names, 0);
5681 for (int i = 0; i < names->length(); i++) { 5692 for (int i = 0; i < names->length(); i++) {
5682 ASSERT(names->get(i)->IsString()); 5693 ASSERT(names->get(i)->IsString());
5683 String* key_string = String::cast(names->get(i)); 5694 Handle<String> key_string(String::cast(names->get(i)));
5684 PropertyAttributes attributes = 5695 PropertyAttributes attributes =
5685 copy->GetLocalPropertyAttribute(key_string); 5696 copy->GetLocalPropertyAttribute(*key_string);
5686 // Only deep copy fields from the object literal expression. 5697 // Only deep copy fields from the object literal expression.
5687 // In particular, don't try to copy the length attribute of 5698 // In particular, don't try to copy the length attribute of
5688 // an array. 5699 // an array.
5689 if (attributes != NONE) continue; 5700 if (attributes != NONE) continue;
5690 Object* value = 5701 Handle<Object> value(
5691 copy->GetProperty(key_string, &attributes)->ToObjectUnchecked(); 5702 copy->GetProperty(*key_string, &attributes)->ToObjectUnchecked(),
5703 isolate);
5692 if (value->IsJSObject()) { 5704 if (value->IsJSObject()) {
5693 JSObject* js_object = JSObject::cast(value); 5705 Handle<Object> result = DeepCopy(Handle<JSObject>::cast(value));
5694 { MaybeObject* maybe_result = js_object->DeepCopy(isolate); 5706 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<JSObject>());
5695 if (!maybe_result->ToObject(&result)) return maybe_result; 5707 // Creating object copy for literals. No strict mode needed.
5696 } 5708 CHECK_NOT_EMPTY_HANDLE(isolate, SetProperty(
5697 { MaybeObject* maybe_result = 5709 copy, key_string, result, NONE, kNonStrictMode));
5698 // Creating object copy for literals. No strict mode needed.
5699 copy->SetProperty(key_string, result, NONE, kNonStrictMode);
5700 if (!maybe_result->ToObject(&result)) return maybe_result;
5701 }
5702 } 5710 }
5703 } 5711 }
5704 } 5712 }
5705 5713
5706 // Deep copy local elements. 5714 // Deep copy local elements.
5707 // Pixel elements cannot be created using an object literal. 5715 // Pixel elements cannot be created using an object literal.
5708 ASSERT(!copy->HasExternalArrayElements()); 5716 ASSERT(!copy->HasExternalArrayElements());
5709 switch (copy->GetElementsKind()) { 5717 switch (copy->GetElementsKind()) {
5710 case FAST_SMI_ELEMENTS: 5718 case FAST_SMI_ELEMENTS:
5711 case FAST_ELEMENTS: 5719 case FAST_ELEMENTS:
5712 case FAST_HOLEY_SMI_ELEMENTS: 5720 case FAST_HOLEY_SMI_ELEMENTS:
5713 case FAST_HOLEY_ELEMENTS: { 5721 case FAST_HOLEY_ELEMENTS: {
5714 FixedArray* elements = FixedArray::cast(copy->elements()); 5722 Handle<FixedArray> elements(FixedArray::cast(copy->elements()));
5715 if (elements->map() == heap->fixed_cow_array_map()) { 5723 if (elements->map() == isolate->heap()->fixed_cow_array_map()) {
5716 isolate->counters()->cow_arrays_created_runtime()->Increment(); 5724 isolate->counters()->cow_arrays_created_runtime()->Increment();
5717 #ifdef DEBUG 5725 #ifdef DEBUG
5718 for (int i = 0; i < elements->length(); i++) { 5726 for (int i = 0; i < elements->length(); i++) {
5719 ASSERT(!elements->get(i)->IsJSObject()); 5727 ASSERT(!elements->get(i)->IsJSObject());
5720 } 5728 }
5721 #endif 5729 #endif
5722 } else { 5730 } else {
5723 for (int i = 0; i < elements->length(); i++) { 5731 for (int i = 0; i < elements->length(); i++) {
5724 Object* value = elements->get(i); 5732 Handle<Object> value(elements->get(i), isolate);
5725 ASSERT(value->IsSmi() || 5733 ASSERT(value->IsSmi() ||
5726 value->IsTheHole() || 5734 value->IsTheHole() ||
5727 (IsFastObjectElementsKind(copy->GetElementsKind()))); 5735 (IsFastObjectElementsKind(copy->GetElementsKind())));
5728 if (value->IsJSObject()) { 5736 if (value->IsJSObject()) {
5729 JSObject* js_object = JSObject::cast(value); 5737 Handle<Object> result = DeepCopy(Handle<JSObject>::cast(value));
5730 { MaybeObject* maybe_result = js_object->DeepCopy(isolate); 5738 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<JSObject>());
5731 if (!maybe_result->ToObject(&result)) return maybe_result; 5739 elements->set(i, *result);
5732 }
5733 elements->set(i, result);
5734 } 5740 }
5735 } 5741 }
5736 } 5742 }
5737 break; 5743 break;
5738 } 5744 }
5739 case DICTIONARY_ELEMENTS: { 5745 case DICTIONARY_ELEMENTS: {
5740 SeededNumberDictionary* element_dictionary = copy->element_dictionary(); 5746 Handle<SeededNumberDictionary> element_dictionary(
5747 copy->element_dictionary());
5741 int capacity = element_dictionary->Capacity(); 5748 int capacity = element_dictionary->Capacity();
5742 for (int i = 0; i < capacity; i++) { 5749 for (int i = 0; i < capacity; i++) {
5743 Object* k = element_dictionary->KeyAt(i); 5750 Object* k = element_dictionary->KeyAt(i);
5744 if (element_dictionary->IsKey(k)) { 5751 if (element_dictionary->IsKey(k)) {
5745 Object* value = element_dictionary->ValueAt(i); 5752 Handle<Object> value(element_dictionary->ValueAt(i), isolate);
5746 if (value->IsJSObject()) { 5753 if (value->IsJSObject()) {
5747 JSObject* js_object = JSObject::cast(value); 5754 Handle<Object> result = DeepCopy(Handle<JSObject>::cast(value));
5748 { MaybeObject* maybe_result = js_object->DeepCopy(isolate); 5755 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<JSObject>());
5749 if (!maybe_result->ToObject(&result)) return maybe_result; 5756 element_dictionary->ValueAtPut(i, *result);
5750 }
5751 element_dictionary->ValueAtPut(i, result);
5752 } 5757 }
5753 } 5758 }
5754 } 5759 }
5755 break; 5760 break;
5756 } 5761 }
5757 case NON_STRICT_ARGUMENTS_ELEMENTS: 5762 case NON_STRICT_ARGUMENTS_ELEMENTS:
5758 UNIMPLEMENTED(); 5763 UNIMPLEMENTED();
5759 break; 5764 break;
5760 case EXTERNAL_PIXEL_ELEMENTS: 5765 case EXTERNAL_PIXEL_ELEMENTS:
5761 case EXTERNAL_BYTE_ELEMENTS: 5766 case EXTERNAL_BYTE_ELEMENTS:
(...skipping 3242 matching lines...) Expand 10 before | Expand all | Expand 10 after
9004 return string; 9009 return string;
9005 } 9010 }
9006 9011
9007 9012
9008 AllocationMemento* AllocationMemento::FindForJSObject(JSObject* object) { 9013 AllocationMemento* AllocationMemento::FindForJSObject(JSObject* object) {
9009 // Currently, AllocationMemento objects are only allocated immediately 9014 // Currently, AllocationMemento objects are only allocated immediately
9010 // after JSArrays in NewSpace, and detecting whether a JSArray has one 9015 // after JSArrays in NewSpace, and detecting whether a JSArray has one
9011 // involves carefully checking the object immediately after the JSArray 9016 // involves carefully checking the object immediately after the JSArray
9012 // (if there is one) to see if it's an AllocationMemento. 9017 // (if there is one) to see if it's an AllocationMemento.
9013 if (FLAG_track_allocation_sites && object->GetHeap()->InNewSpace(object)) { 9018 if (FLAG_track_allocation_sites && object->GetHeap()->InNewSpace(object)) {
9014 // TODO(mvstanton): CHECK to diagnose chromium bug 284577, remove after. 9019 ASSERT(object->GetHeap()->InToSpace(object));
9015 CHECK(object->GetHeap()->InToSpace(object));
9016 Address ptr_end = (reinterpret_cast<Address>(object) - kHeapObjectTag) + 9020 Address ptr_end = (reinterpret_cast<Address>(object) - kHeapObjectTag) +
9017 object->Size(); 9021 object->Size();
9018 if ((ptr_end + AllocationMemento::kSize) <= 9022 if ((ptr_end + AllocationMemento::kSize) <=
9019 object->GetHeap()->NewSpaceTop()) { 9023 object->GetHeap()->NewSpaceTop()) {
9020 // There is room in newspace for allocation info. Do we have some? 9024 // There is room in newspace for allocation info. Do we have some?
9021 Map** possible_allocation_memento_map = 9025 Map** possible_allocation_memento_map =
9022 reinterpret_cast<Map**>(ptr_end); 9026 reinterpret_cast<Map**>(ptr_end);
9023 if (*possible_allocation_memento_map == 9027 if (*possible_allocation_memento_map ==
9024 object->GetHeap()->allocation_memento_map()) { 9028 object->GetHeap()->allocation_memento_map()) {
9025 Address ptr_object = reinterpret_cast<Address>(object);
9026 // TODO(mvstanton): CHECK to diagnose chromium bug 284577, remove after.
9027 // If this check fails it points to the very unlikely case that we've
9028 // misinterpreted a page header as an allocation memento. Follow up
9029 // with a real fix.
9030 CHECK(Page::FromAddress(ptr_object) == Page::FromAddress(ptr_end));
9031 AllocationMemento* memento = AllocationMemento::cast( 9029 AllocationMemento* memento = AllocationMemento::cast(
9032 reinterpret_cast<Object*>(ptr_end + kHeapObjectTag)); 9030 reinterpret_cast<Object*>(ptr_end + kHeapObjectTag));
9033 return memento; 9031
9032 // TODO(mvstanton): because of chromium bug 284577, put extra care
9033 // into validating that the memento points to a valid AllocationSite.
9034 // This check is expensive so remove it asap. Also, this check
9035 // HIDES bug 284577, so it must be disabled to debug/diagnose.
9036 Object* site = memento->allocation_site();
9037 Heap* heap = object->GetHeap();
9038 if (heap->InOldPointerSpace(site) &&
9039 site->IsHeapObject() &&
9040 HeapObject::cast(site)->map() == heap->allocation_site_map()) {
9041 return memento;
9042 }
9034 } 9043 }
9035 } 9044 }
9036 } 9045 }
9037 return NULL; 9046 return NULL;
9038 } 9047 }
9039 9048
9040 9049
9041 uint32_t StringHasher::MakeArrayIndexHash(uint32_t value, int length) { 9050 uint32_t StringHasher::MakeArrayIndexHash(uint32_t value, int length) {
9042 // For array indexes mix the length into the hash as an array index could 9051 // For array indexes mix the length into the hash as an array index could
9043 // be zero. 9052 // be zero.
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
9314 PrintF(" ** Marking "); 9323 PrintF(" ** Marking ");
9315 PrintName(); 9324 PrintName();
9316 PrintF(" for concurrent recompilation.\n"); 9325 PrintF(" for concurrent recompilation.\n");
9317 } 9326 }
9318 set_code_no_write_barrier( 9327 set_code_no_write_barrier(
9319 GetIsolate()->builtins()->builtin(Builtins::kConcurrentRecompile)); 9328 GetIsolate()->builtins()->builtin(Builtins::kConcurrentRecompile));
9320 // No write barrier required, since the builtin is part of the root set. 9329 // No write barrier required, since the builtin is part of the root set.
9321 } 9330 }
9322 9331
9323 9332
9324 void JSFunction::MarkForInstallingRecompiledCode() {
9325 // The debugger could have switched the builtin to lazy compile.
9326 // In that case, simply carry on. It will be dealt with later.
9327 ASSERT(!IsOptimized());
9328 ASSERT(shared()->allows_lazy_compilation() || code()->optimizable());
9329 ASSERT(FLAG_concurrent_recompilation);
9330 set_code_no_write_barrier(
9331 GetIsolate()->builtins()->builtin(Builtins::kInstallRecompiledCode));
9332 // No write barrier required, since the builtin is part of the root set.
9333 }
9334
9335
9336 void JSFunction::MarkInRecompileQueue() { 9333 void JSFunction::MarkInRecompileQueue() {
9337 // We can only arrive here via the concurrent-recompilation builtin. If 9334 // We can only arrive here via the concurrent-recompilation builtin. If
9338 // break points were set, the code would point to the lazy-compile builtin. 9335 // break points were set, the code would point to the lazy-compile builtin.
9339 ASSERT(!GetIsolate()->DebuggerHasBreakPoints()); 9336 ASSERT(!GetIsolate()->DebuggerHasBreakPoints());
9340 ASSERT(IsMarkedForConcurrentRecompilation() && !IsOptimized()); 9337 ASSERT(IsMarkedForConcurrentRecompilation() && !IsOptimized());
9341 ASSERT(shared()->allows_lazy_compilation() || code()->optimizable()); 9338 ASSERT(shared()->allows_lazy_compilation() || code()->optimizable());
9342 ASSERT(FLAG_concurrent_recompilation); 9339 ASSERT(FLAG_concurrent_recompilation);
9343 if (FLAG_trace_concurrent_recompilation) { 9340 if (FLAG_trace_concurrent_recompilation) {
9344 PrintF(" ** Queueing "); 9341 PrintF(" ** Queueing ");
9345 PrintName(); 9342 PrintName();
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after
10436 } 10433 }
10437 10434
10438 10435
10439 bool Code::allowed_in_shared_map_code_cache() { 10436 bool Code::allowed_in_shared_map_code_cache() {
10440 return is_keyed_load_stub() || is_keyed_store_stub() || 10437 return is_keyed_load_stub() || is_keyed_store_stub() ||
10441 (is_compare_ic_stub() && 10438 (is_compare_ic_stub() &&
10442 ICCompareStub::CompareState(stub_info()) == CompareIC::KNOWN_OBJECT); 10439 ICCompareStub::CompareState(stub_info()) == CompareIC::KNOWN_OBJECT);
10443 } 10440 }
10444 10441
10445 10442
10446 void Code::MakeCodeAgeSequenceYoung(byte* sequence) { 10443 void Code::MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate) {
10447 PatchPlatformCodeAge(sequence, kNoAge, NO_MARKING_PARITY); 10444 PatchPlatformCodeAge(isolate, sequence, kNoAge, NO_MARKING_PARITY);
10448 } 10445 }
10449 10446
10450 10447
10451 void Code::MakeOlder(MarkingParity current_parity) { 10448 void Code::MakeOlder(MarkingParity current_parity) {
10452 byte* sequence = FindCodeAgeSequence(); 10449 byte* sequence = FindCodeAgeSequence();
10453 if (sequence != NULL) { 10450 if (sequence != NULL) {
10454 Age age; 10451 Age age;
10455 MarkingParity code_parity; 10452 MarkingParity code_parity;
10456 GetCodeAgeAndParity(sequence, &age, &code_parity); 10453 GetCodeAgeAndParity(sequence, &age, &code_parity);
10457 if (age != kLastCodeAge && code_parity != current_parity) { 10454 if (age != kLastCodeAge && code_parity != current_parity) {
10458 PatchPlatformCodeAge(sequence, static_cast<Age>(age + 1), 10455 PatchPlatformCodeAge(GetIsolate(),
10456 sequence,
10457 static_cast<Age>(age + 1),
10459 current_parity); 10458 current_parity);
10460 } 10459 }
10461 } 10460 }
10462 } 10461 }
10463 10462
10464 10463
10465 bool Code::IsOld() { 10464 bool Code::IsOld() {
10466 byte* sequence = FindCodeAgeSequence(); 10465 byte* sequence = FindCodeAgeSequence();
10467 if (sequence == NULL) return false; 10466 if (sequence == NULL) return false;
10468 Age age; 10467 Age age;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
10511 *age = k##AGE##CodeAge; \ 10510 *age = k##AGE##CodeAge; \
10512 *parity = ODD_MARKING_PARITY; \ 10511 *parity = ODD_MARKING_PARITY; \
10513 return; \ 10512 return; \
10514 } 10513 }
10515 CODE_AGE_LIST(HANDLE_CODE_AGE) 10514 CODE_AGE_LIST(HANDLE_CODE_AGE)
10516 #undef HANDLE_CODE_AGE 10515 #undef HANDLE_CODE_AGE
10517 UNREACHABLE(); 10516 UNREACHABLE();
10518 } 10517 }
10519 10518
10520 10519
10521 Code* Code::GetCodeAgeStub(Age age, MarkingParity parity) { 10520 Code* Code::GetCodeAgeStub(Isolate* isolate, Age age, MarkingParity parity) {
10522 Isolate* isolate = Isolate::Current();
10523 Builtins* builtins = isolate->builtins(); 10521 Builtins* builtins = isolate->builtins();
10524 switch (age) { 10522 switch (age) {
10525 #define HANDLE_CODE_AGE(AGE) \ 10523 #define HANDLE_CODE_AGE(AGE) \
10526 case k##AGE##CodeAge: { \ 10524 case k##AGE##CodeAge: { \
10527 Code* stub = parity == EVEN_MARKING_PARITY \ 10525 Code* stub = parity == EVEN_MARKING_PARITY \
10528 ? *builtins->Make##AGE##CodeYoungAgainEvenMarking() \ 10526 ? *builtins->Make##AGE##CodeYoungAgainEvenMarking() \
10529 : *builtins->Make##AGE##CodeYoungAgainOddMarking(); \ 10527 : *builtins->Make##AGE##CodeYoungAgainOddMarking(); \
10530 return stub; \ 10528 return stub; \
10531 } 10529 }
10532 CODE_AGE_LIST(HANDLE_CODE_AGE) 10530 CODE_AGE_LIST(HANDLE_CODE_AGE)
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
10783 } 10781 }
10784 10782
10785 10783
10786 const char* Code::StubType2String(StubType type) { 10784 const char* Code::StubType2String(StubType type) {
10787 switch (type) { 10785 switch (type) {
10788 case NORMAL: return "NORMAL"; 10786 case NORMAL: return "NORMAL";
10789 case FIELD: return "FIELD"; 10787 case FIELD: return "FIELD";
10790 case CONSTANT: return "CONSTANT"; 10788 case CONSTANT: return "CONSTANT";
10791 case CALLBACKS: return "CALLBACKS"; 10789 case CALLBACKS: return "CALLBACKS";
10792 case INTERCEPTOR: return "INTERCEPTOR"; 10790 case INTERCEPTOR: return "INTERCEPTOR";
10793 case MAP_TRANSITION: return "MAP_TRANSITION"; 10791 case TRANSITION: return "TRANSITION";
10794 case NONEXISTENT: return "NONEXISTENT"; 10792 case NONEXISTENT: return "NONEXISTENT";
10795 } 10793 }
10796 UNREACHABLE(); // keep the compiler happy 10794 UNREACHABLE(); // keep the compiler happy
10797 return NULL; 10795 return NULL;
10798 } 10796 }
10799 10797
10800 10798
10801 void Code::PrintExtraICState(FILE* out, Kind kind, ExtraICState extra) { 10799 void Code::PrintExtraICState(FILE* out, Kind kind, ExtraICState extra) {
10802 PrintF(out, "extra_ic_state = "); 10800 PrintF(out, "extra_ic_state = ");
10803 const char* name = NULL; 10801 const char* name = NULL;
(...skipping 5352 matching lines...) Expand 10 before | Expand all | Expand 10 after
16156 #define ERROR_MESSAGES_TEXTS(C, T) T, 16154 #define ERROR_MESSAGES_TEXTS(C, T) T,
16157 static const char* error_messages_[] = { 16155 static const char* error_messages_[] = {
16158 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16156 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16159 }; 16157 };
16160 #undef ERROR_MESSAGES_TEXTS 16158 #undef ERROR_MESSAGES_TEXTS
16161 return error_messages_[reason]; 16159 return error_messages_[reason];
16162 } 16160 }
16163 16161
16164 16162
16165 } } // namespace v8::internal 16163 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698