OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <iomanip> | 5 #include <iomanip> |
6 #include <sstream> | 6 #include <sstream> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 4109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4120 return false; | 4120 return false; |
4121 } | 4121 } |
4122 JSObject::MigrateToMap(object, new_map); | 4122 JSObject::MigrateToMap(object, new_map); |
4123 if (FLAG_trace_migration) { | 4123 if (FLAG_trace_migration) { |
4124 object->PrintInstanceMigration(stdout, *original_map, object->map()); | 4124 object->PrintInstanceMigration(stdout, *original_map, object->map()); |
4125 } | 4125 } |
4126 return true; | 4126 return true; |
4127 } | 4127 } |
4128 | 4128 |
4129 | 4129 |
4130 void JSObject::WriteToField(int descriptor, Object* value) { | |
4131 DisallowHeapAllocation no_gc; | |
4132 | |
4133 DescriptorArray* desc = map()->instance_descriptors(); | |
4134 PropertyDetails details = desc->GetDetails(descriptor); | |
4135 | |
4136 DCHECK(details.type() == DATA); | |
4137 | |
4138 FieldIndex index = FieldIndex::ForDescriptor(map(), descriptor); | |
4139 if (details.representation().IsDouble()) { | |
4140 // Nothing more to be done. | |
4141 if (value->IsUninitialized()) return; | |
4142 if (IsUnboxedDoubleField(index)) { | |
4143 RawFastDoublePropertyAtPut(index, value->Number()); | |
4144 } else { | |
4145 HeapNumber* box = HeapNumber::cast(RawFastPropertyAt(index)); | |
4146 DCHECK(box->IsMutableHeapNumber()); | |
4147 box->set_value(value->Number()); | |
4148 } | |
4149 } else { | |
4150 RawFastPropertyAtPut(index, value); | |
4151 } | |
4152 } | |
4153 | |
4154 | |
4155 void JSObject::AddProperty(Handle<JSObject> object, Handle<Name> name, | 4130 void JSObject::AddProperty(Handle<JSObject> object, Handle<Name> name, |
4156 Handle<Object> value, | 4131 Handle<Object> value, |
4157 PropertyAttributes attributes) { | 4132 PropertyAttributes attributes) { |
4158 LookupIterator it(object, name, LookupIterator::OWN_SKIP_INTERCEPTOR); | 4133 LookupIterator it(object, name, LookupIterator::OWN_SKIP_INTERCEPTOR); |
4159 CHECK_NE(LookupIterator::ACCESS_CHECK, it.state()); | 4134 CHECK_NE(LookupIterator::ACCESS_CHECK, it.state()); |
4160 #ifdef DEBUG | 4135 #ifdef DEBUG |
4161 uint32_t index; | 4136 uint32_t index; |
4162 DCHECK(!object->IsJSProxy()); | 4137 DCHECK(!object->IsJSProxy()); |
4163 DCHECK(!name->AsArrayIndex(&index)); | 4138 DCHECK(!name->AsArrayIndex(&index)); |
4164 Maybe<PropertyAttributes> maybe = GetPropertyAttributes(&it); | 4139 Maybe<PropertyAttributes> maybe = GetPropertyAttributes(&it); |
(...skipping 13001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17166 CompilationInfo* info) { | 17141 CompilationInfo* info) { |
17167 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( | 17142 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( |
17168 handle(cell->dependent_code(), info->isolate()), | 17143 handle(cell->dependent_code(), info->isolate()), |
17169 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); | 17144 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); |
17170 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 17145 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
17171 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 17146 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
17172 cell, info->zone()); | 17147 cell, info->zone()); |
17173 } | 17148 } |
17174 | 17149 |
17175 } } // namespace v8::internal | 17150 } } // namespace v8::internal |
OLD | NEW |