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

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: Created 7 years, 8 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 | « .gitignore ('k') | 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 flags = static_cast<HAllocate::Flags>( 361 flags = static_cast<HAllocate::Flags>(
362 flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE); 362 flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE);
363 } 363 }
364 HInstruction* object = 364 HInstruction* object =
365 AddInstruction(new(zone) HAllocate(context(), 365 AddInstruction(new(zone) HAllocate(context(),
366 size_in_bytes, 366 size_in_bytes,
367 HType::JSObject(), 367 HType::JSObject(),
368 flags)); 368 flags));
369 369
370 for (int i = 0; i < size; i += kPointerSize) { 370 for (int i = 0; i < size; i += kPointerSize) {
371 ObjectAccess access = AccessInobject(factory->empty_string(), i);
danno 2013/04/26 09:39:38 Instead of taking the field name, I think this ver
titzer 2013/04/30 15:56:47 Sure. Deferring this change to the follow-up CL.
371 HInstruction* value = 372 HInstruction* value =
372 AddInstruction(new(zone) HLoadNamedField(boilerplate, true, i)); 373 AddInstruction(new(zone) HLoadNamedField(boilerplate, access));
373 AddInstruction(new(zone) HStoreNamedField(object, 374 AddStore(object, access, value);
374 factory->empty_string(),
375 value,
376 true, i));
377 } 375 }
378 376
379 checker.ElseDeopt(); 377 checker.ElseDeopt();
380 return object; 378 return object;
381 } 379 }
382 380
383 381
384 Handle<Code> FastCloneShallowObjectStub::GenerateCode() { 382 Handle<Code> FastCloneShallowObjectStub::GenerateCode() {
385 return DoGenerateCode(this); 383 return DoGenerateCode(this);
386 } 384 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() { 419 HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() {
422 Zone* zone = this->zone(); 420 Zone* zone = this->zone();
423 421
424 HValue* js_array = GetParameter(0); 422 HValue* js_array = GetParameter(0);
425 HValue* map = GetParameter(1); 423 HValue* map = GetParameter(1);
426 424
427 info()->MarkAsSavesCallerDoubles(); 425 info()->MarkAsSavesCallerDoubles();
428 426
429 AddInstruction(new(zone) HTrapAllocationMemento(js_array)); 427 AddInstruction(new(zone) HTrapAllocationMemento(js_array));
430 428
431 HInstruction* array_length = 429 HInstruction* array_length = AddInstruction(
432 AddInstruction(HLoadNamedField::NewArrayLength( 430 new(zone) HLoadNamedField(js_array, AccessArrayLength()));
433 zone, js_array, js_array, HType::Smi())); 431 array_length->set_type(HType::Smi());
434 432
435 ElementsKind to_kind = casted_stub()->to_kind(); 433 ElementsKind to_kind = casted_stub()->to_kind();
436 BuildNewSpaceArrayCheck(array_length, to_kind); 434 BuildNewSpaceArrayCheck(array_length, to_kind);
437 435
438 IfBuilder if_builder(this); 436 IfBuilder if_builder(this);
439 437
440 if_builder.IfCompare(array_length, graph()->GetConstant0(), Token::EQ); 438 if_builder.IfCompare(array_length, graph()->GetConstant0(), Token::EQ);
441 if_builder.Then(); 439 if_builder.Then();
442 440
443 // Nothing to do, just change the map. 441 // Nothing to do, just change the map.
444 442
445 if_builder.Else(); 443 if_builder.Else();
446 444
447 HInstruction* elements = 445 HInstruction* elements =
448 AddInstruction(new(zone) HLoadElements(js_array, js_array)); 446 AddInstruction(new(zone) HLoadElements(js_array, js_array));
449 447
450 HInstruction* elements_length = 448 HInstruction* elements_length =
451 AddInstruction(new(zone) HFixedArrayBaseLength(elements)); 449 AddInstruction(new(zone) HFixedArrayBaseLength(elements));
452 450
453 HValue* new_elements = 451 HValue* new_elements =
454 BuildAllocateAndInitializeElements(context(), to_kind, elements_length); 452 BuildAllocateAndInitializeElements(context(), to_kind, elements_length);
455 453
456 BuildCopyElements(context(), elements, 454 BuildCopyElements(context(), elements,
457 casted_stub()->from_kind(), new_elements, 455 casted_stub()->from_kind(), new_elements,
458 to_kind, array_length, elements_length); 456 to_kind, array_length, elements_length);
459 457
460 Factory* factory = isolate()->factory(); 458 AddStore(js_array, AccessElements(), new_elements);
461
462 AddInstruction(new(zone) HStoreNamedField(js_array,
463 factory->elements_field_string(),
464 new_elements, true,
465 JSArray::kElementsOffset));
466 459
467 if_builder.End(); 460 if_builder.End();
468 461
469 AddInstruction(new(zone) HStoreNamedField(js_array, factory->length_string(), 462 AddStore(js_array, AccessMap(), map);
470 map, true, JSArray::kMapOffset)); 463
471 return js_array; 464 return js_array;
472 } 465 }
473 466
474 467
475 Handle<Code> TransitionElementsKindStub::GenerateCode() { 468 Handle<Code> TransitionElementsKindStub::GenerateCode() {
476 return DoGenerateCode(this); 469 return DoGenerateCode(this);
477 } 470 }
478 471
479 472
480 template <> 473 template <>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 ? graph()->GetConstantSmi1() 532 ? graph()->GetConstantSmi1()
540 : graph()->GetConstantUndefined(); 533 : graph()->GetConstantUndefined();
541 } 534 }
542 535
543 536
544 Handle<Code> CompareNilICStub::GenerateCode() { 537 Handle<Code> CompareNilICStub::GenerateCode() {
545 return DoGenerateCode(this); 538 return DoGenerateCode(this);
546 } 539 }
547 540
548 } } // namespace v8::internal 541 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « .gitignore ('k') | src/hydrogen.h » ('j') | src/hydrogen.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698