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

Side by Side Diff: src/code-stubs-hydrogen.cc

Issue 14284010: Introduce HObjectAccess, which is used by LoadNamedField and StoreNamedField to denote what parts (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Some small cleanups; add AddLoad to simplify construction of loads Created 7 years, 7 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 | « no previous file | src/hydrogen.h » ('j') | src/hydrogen.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 flags = static_cast<HAllocate::Flags>( 369 flags = static_cast<HAllocate::Flags>(
370 flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE); 370 flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE);
371 } 371 }
372 HInstruction* object = 372 HInstruction* object =
373 AddInstruction(new(zone) HAllocate(context(), 373 AddInstruction(new(zone) HAllocate(context(),
374 size_in_bytes, 374 size_in_bytes,
375 HType::JSObject(), 375 HType::JSObject(),
376 flags)); 376 flags));
377 377
378 for (int i = 0; i < size; i += kPointerSize) { 378 for (int i = 0; i < size; i += kPointerSize) {
379 HObjectAccess* access = AccessInobject(factory->empty_string(), i);
danno 2013/05/02 14:16:47 s/AccessInobject/AccessInObjectProperty
titzer 2013/05/03 09:18:41 I've moved this method to HObjectAccess::ForInobje
379 HInstruction* value = 380 HInstruction* value =
380 AddInstruction(new(zone) HLoadNamedField( 381 AddInstruction(new(zone) HLoadNamedField(boilerplate, access));
danno 2013/05/02 14:16:47 nit: 4 char indent (please run tools/presubmit.py
titzer 2013/05/03 09:18:41 Done.
381 boilerplate, true, Representation::Tagged(), i)); 382 AddStore(object, access, value);
382 AddInstruction(new(zone) HStoreNamedField(object,
383 factory->empty_string(),
384 value, true,
385 Representation::Tagged(), i));
386 } 383 }
387 384
388 checker.ElseDeopt(); 385 checker.ElseDeopt();
389 return object; 386 return object;
390 } 387 }
391 388
392 389
393 Handle<Code> FastCloneShallowObjectStub::GenerateCode() { 390 Handle<Code> FastCloneShallowObjectStub::GenerateCode() {
394 return DoGenerateCode(this); 391 return DoGenerateCode(this);
395 } 392 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() { 427 HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() {
431 Zone* zone = this->zone(); 428 Zone* zone = this->zone();
432 429
433 HValue* js_array = GetParameter(0); 430 HValue* js_array = GetParameter(0);
434 HValue* map = GetParameter(1); 431 HValue* map = GetParameter(1);
435 432
436 info()->MarkAsSavesCallerDoubles(); 433 info()->MarkAsSavesCallerDoubles();
437 434
438 AddInstruction(new(zone) HTrapAllocationMemento(js_array)); 435 AddInstruction(new(zone) HTrapAllocationMemento(js_array));
439 436
440 HInstruction* array_length = 437 HInstruction* array_length = AddInstruction(
441 AddInstruction(HLoadNamedField::NewArrayLength( 438 new(zone) HLoadNamedField(js_array, AccessArrayLength()));
442 zone, js_array, js_array, HType::Smi())); 439 array_length->set_type(HType::Smi());
443 440
444 ElementsKind to_kind = casted_stub()->to_kind(); 441 ElementsKind to_kind = casted_stub()->to_kind();
445 BuildNewSpaceArrayCheck(array_length, to_kind); 442 BuildNewSpaceArrayCheck(array_length, to_kind);
446 443
447 IfBuilder if_builder(this); 444 IfBuilder if_builder(this);
448 445
449 if_builder.IfCompare(array_length, graph()->GetConstant0(), Token::EQ); 446 if_builder.IfCompare(array_length, graph()->GetConstant0(), Token::EQ);
450 if_builder.Then(); 447 if_builder.Then();
451 448
452 // Nothing to do, just change the map. 449 // Nothing to do, just change the map.
453 450
454 if_builder.Else(); 451 if_builder.Else();
455 452
456 HInstruction* elements = 453 HInstruction* elements =
457 AddInstruction(new(zone) HLoadElements(js_array, js_array)); 454 AddInstruction(new(zone) HLoadElements(js_array, js_array));
458 455
459 HInstruction* elements_length = 456 HInstruction* elements_length =
460 AddInstruction(new(zone) HFixedArrayBaseLength(elements)); 457 AddInstruction(new(zone) HFixedArrayBaseLength(elements));
461 458
462 HValue* new_elements = 459 HValue* new_elements =
463 BuildAllocateAndInitializeElements(context(), to_kind, elements_length); 460 BuildAllocateAndInitializeElements(context(), to_kind, elements_length);
464 461
465 BuildCopyElements(context(), elements, 462 BuildCopyElements(context(), elements,
466 casted_stub()->from_kind(), new_elements, 463 casted_stub()->from_kind(), new_elements,
467 to_kind, array_length, elements_length); 464 to_kind, array_length, elements_length);
468 465
469 Factory* factory = isolate()->factory(); 466 AddStore(js_array, AccessElements(), new_elements);
470
471 AddInstruction(new(zone) HStoreNamedField(js_array,
472 factory->elements_field_string(),
473 new_elements, true,
474 Representation::Tagged(),
475 JSArray::kElementsOffset));
476 467
477 if_builder.End(); 468 if_builder.End();
478 469
479 AddInstruction(new(zone) HStoreNamedField(js_array, factory->length_string(), 470 AddStore(js_array, AccessMap(), map);
480 map, true, 471
481 Representation::Tagged(),
482 JSArray::kMapOffset));
483 return js_array; 472 return js_array;
484 } 473 }
485 474
486 475
487 Handle<Code> TransitionElementsKindStub::GenerateCode() { 476 Handle<Code> TransitionElementsKindStub::GenerateCode() {
488 return DoGenerateCode(this); 477 return DoGenerateCode(this);
489 } 478 }
490 479
491 480
492 template <> 481 template <>
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 ? graph()->GetConstantSmi1() 623 ? graph()->GetConstantSmi1()
635 : graph()->GetConstantUndefined(); 624 : graph()->GetConstantUndefined();
636 } 625 }
637 626
638 627
639 Handle<Code> CompareNilICStub::GenerateCode() { 628 Handle<Code> CompareNilICStub::GenerateCode() {
640 return DoGenerateCode(this); 629 return DoGenerateCode(this);
641 } 630 }
642 631
643 } } // namespace v8::internal 632 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen.h » ('j') | src/hydrogen.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698