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

Side by Side Diff: src/ic/handler-compiler.cc

Issue 774473004: Use weak cells to embed maps in store handler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix arm64 Created 6 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
« no previous file with comments | « src/ic/handler-compiler.h ('k') | src/ic/ia32/handler-compiler-ia32.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 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
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
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
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
OLDNEW
« no previous file with comments | « src/ic/handler-compiler.h ('k') | src/ic/ia32/handler-compiler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698