OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/ic/call-optimization.h" | 7 #include "src/ic/call-optimization.h" |
8 #include "src/ic/handler-compiler.h" | 8 #include "src/ic/handler-compiler.h" |
9 #include "src/ic/ic.h" | 9 #include "src/ic/ic.h" |
10 #include "src/ic/ic-inl.h" | 10 #include "src/ic/ic-inl.h" |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 GenerateLoadViaGetter(masm(), type(), receiver(), getter); | 305 GenerateLoadViaGetter(masm(), type(), receiver(), getter); |
306 return GetCode(kind(), Code::FAST, name); | 306 return GetCode(kind(), Code::FAST, name); |
307 } | 307 } |
308 | 308 |
309 | 309 |
310 // TODO(verwaest): Cleanup. holder() is actually the receiver. | 310 // TODO(verwaest): Cleanup. holder() is actually the receiver. |
311 Handle<Code> NamedStoreHandlerCompiler::CompileStoreTransition( | 311 Handle<Code> NamedStoreHandlerCompiler::CompileStoreTransition( |
312 Handle<Map> transition, Handle<Name> name) { | 312 Handle<Map> transition, Handle<Name> name) { |
313 Label miss; | 313 Label miss; |
314 | 314 |
315 // Ensure no transitions to deprecated maps are followed. | |
316 __ CheckMapDeprecated(transition, scratch1(), &miss); | |
317 | |
318 // Check that we are allowed to write this. | 315 // Check that we are allowed to write this. |
319 bool is_nonexistent = holder()->map() == transition->GetBackPointer(); | 316 bool is_nonexistent = holder()->map() == transition->GetBackPointer(); |
320 if (is_nonexistent) { | 317 if (is_nonexistent) { |
321 // Find the top object. | 318 // Find the top object. |
322 Handle<JSObject> last; | 319 Handle<JSObject> last; |
323 PrototypeIterator iter(isolate(), holder()); | 320 PrototypeIterator iter(isolate(), holder()); |
324 while (!iter.IsAtEnd()) { | 321 while (!iter.IsAtEnd()) { |
325 last = Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)); | 322 last = Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)); |
326 iter.Advance(); | 323 iter.Advance(); |
327 } | 324 } |
(...skipping 10 matching lines...) Expand all Loading... |
338 Representation representation = details.representation(); | 335 Representation representation = details.representation(); |
339 DCHECK(!representation.IsNone()); | 336 DCHECK(!representation.IsNone()); |
340 | 337 |
341 // Stub is never generated for objects that require access checks. | 338 // Stub is never generated for objects that require access checks. |
342 DCHECK(!transition->is_access_check_needed()); | 339 DCHECK(!transition->is_access_check_needed()); |
343 | 340 |
344 // Call to respective StoreTransitionStub. | 341 // Call to respective StoreTransitionStub. |
345 if (details.type() == CONSTANT) { | 342 if (details.type() == CONSTANT) { |
346 GenerateConstantCheck(descriptors->GetValue(descriptor), value(), &miss); | 343 GenerateConstantCheck(descriptors->GetValue(descriptor), value(), &miss); |
347 | 344 |
348 GenerateRestoreNameAndMap(name, transition); | 345 GenerateRestoreMap(transition, scratch2(), &miss); |
| 346 GenerateRestoreName(name); |
349 StoreTransitionStub stub(isolate()); | 347 StoreTransitionStub stub(isolate()); |
350 GenerateTailCall(masm(), stub.GetCode()); | 348 GenerateTailCall(masm(), stub.GetCode()); |
351 | 349 |
352 } else { | 350 } else { |
353 if (representation.IsHeapObject()) { | 351 if (representation.IsHeapObject()) { |
354 GenerateFieldTypeChecks(descriptors->GetFieldType(descriptor), value(), | 352 GenerateFieldTypeChecks(descriptors->GetFieldType(descriptor), value(), |
355 &miss); | 353 &miss); |
356 } | 354 } |
357 StoreTransitionStub::StoreMode store_mode = | 355 StoreTransitionStub::StoreMode store_mode = |
358 Map::cast(transition->GetBackPointer())->unused_property_fields() == 0 | 356 Map::cast(transition->GetBackPointer())->unused_property_fields() == 0 |
359 ? StoreTransitionStub::ExtendStorageAndStoreMapAndValue | 357 ? StoreTransitionStub::ExtendStorageAndStoreMapAndValue |
360 : StoreTransitionStub::StoreMapAndValue; | 358 : StoreTransitionStub::StoreMapAndValue; |
361 | 359 |
362 GenerateRestoreNameAndMap(name, transition); | 360 GenerateRestoreMap(transition, scratch2(), &miss); |
| 361 GenerateRestoreName(name); |
363 StoreTransitionStub stub(isolate(), | 362 StoreTransitionStub stub(isolate(), |
364 FieldIndex::ForDescriptor(*transition, descriptor), | 363 FieldIndex::ForDescriptor(*transition, descriptor), |
365 representation, store_mode); | 364 representation, store_mode); |
366 GenerateTailCall(masm(), stub.GetCode()); | 365 GenerateTailCall(masm(), stub.GetCode()); |
367 } | 366 } |
368 | 367 |
369 GenerateRestoreName(&miss, name); | 368 GenerateRestoreName(&miss, name); |
370 TailCallBuiltin(masm(), MissBuiltin(kind())); | 369 TailCallBuiltin(masm(), MissBuiltin(kind())); |
371 | 370 |
372 return GetCode(kind(), Code::FAST, name); | 371 return GetCode(kind(), Code::FAST, name); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 DCHECK(elements_kind == DICTIONARY_ELEMENTS); | 435 DCHECK(elements_kind == DICTIONARY_ELEMENTS); |
437 cached_stub = LoadDictionaryElementStub(isolate()).GetCode(); | 436 cached_stub = LoadDictionaryElementStub(isolate()).GetCode(); |
438 } | 437 } |
439 } | 438 } |
440 | 439 |
441 handlers->Add(cached_stub); | 440 handlers->Add(cached_stub); |
442 } | 441 } |
443 } | 442 } |
444 } | 443 } |
445 } // namespace v8::internal | 444 } // namespace v8::internal |
OLD | NEW |