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

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

Issue 712973002: harmony-scoping: Implement StoreIC handler for stores to global contexts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments + rebased Created 6 years, 1 month 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 | « src/code-stubs.h ('k') | src/hydrogen.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/bailout-reason.h" 7 #include "src/bailout-reason.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/field-index.h" 9 #include "src/field-index.h"
10 #include "src/hydrogen.h" 10 #include "src/hydrogen.h"
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 Handle<Code> CreateAllocationSiteStub::GenerateCode() { 511 Handle<Code> CreateAllocationSiteStub::GenerateCode() {
512 return DoGenerateCode(this); 512 return DoGenerateCode(this);
513 } 513 }
514 514
515 515
516 template <> 516 template <>
517 HValue* CodeStubGraphBuilder<LoadGlobalContextFieldStub>::BuildCodeStub() { 517 HValue* CodeStubGraphBuilder<LoadGlobalContextFieldStub>::BuildCodeStub() {
518 int context_index = casted_stub()->context_index(); 518 int context_index = casted_stub()->context_index();
519 int slot_index = casted_stub()->slot_index(); 519 int slot_index = casted_stub()->slot_index();
520 520
521 HValue* native_context = BuildGetNativeContext(); 521 HValue* global_context = BuildGetGlobalContext(context_index);
522 HValue* global_context_table = Add<HLoadNamedField>(
523 native_context, static_cast<HValue*>(NULL),
524 HObjectAccess::ForContextSlot(Context::GLOBAL_CONTEXT_TABLE_INDEX));
525 HValue* global_context =
526 Add<HLoadNamedField>(global_context_table, static_cast<HValue*>(NULL),
527 HObjectAccess::ForGlobalContext(context_index));
528 return Add<HLoadNamedField>(global_context, static_cast<HValue*>(NULL), 522 return Add<HLoadNamedField>(global_context, static_cast<HValue*>(NULL),
529 HObjectAccess::ForContextSlot(slot_index)); 523 HObjectAccess::ForContextSlot(slot_index));
530 } 524 }
531 525
532 526
533 Handle<Code> LoadGlobalContextFieldStub::GenerateCode() { 527 Handle<Code> LoadGlobalContextFieldStub::GenerateCode() {
534 return DoGenerateCode(this); 528 return DoGenerateCode(this);
535 } 529 }
536 530
537 531
538 template <> 532 template <>
533 HValue* CodeStubGraphBuilder<StoreGlobalContextFieldStub>::BuildCodeStub() {
534 int context_index = casted_stub()->context_index();
535 int slot_index = casted_stub()->slot_index();
536
537 HValue* global_context = BuildGetGlobalContext(context_index);
538 Add<HStoreNamedField>(global_context,
539 HObjectAccess::ForContextSlot(slot_index),
540 GetParameter(2), STORE_TO_INITIALIZED_ENTRY);
541 return GetParameter(2);
542 }
543
544
545 Handle<Code> StoreGlobalContextFieldStub::GenerateCode() {
546 return DoGenerateCode(this);
547 }
548
549
550 template <>
539 HValue* CodeStubGraphBuilder<LoadFastElementStub>::BuildCodeStub() { 551 HValue* CodeStubGraphBuilder<LoadFastElementStub>::BuildCodeStub() {
540 HInstruction* load = BuildUncheckedMonomorphicElementAccess( 552 HInstruction* load = BuildUncheckedMonomorphicElementAccess(
541 GetParameter(LoadDescriptor::kReceiverIndex), 553 GetParameter(LoadDescriptor::kReceiverIndex),
542 GetParameter(LoadDescriptor::kNameIndex), NULL, 554 GetParameter(LoadDescriptor::kNameIndex), NULL,
543 casted_stub()->is_js_array(), casted_stub()->elements_kind(), LOAD, 555 casted_stub()->is_js_array(), casted_stub()->elements_kind(), LOAD,
544 NEVER_RETURN_HOLE, STANDARD_STORE); 556 NEVER_RETURN_HOLE, STANDARD_STORE);
545 return load; 557 return load;
546 } 558 }
547 559
548 560
(...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after
2029 2041
2030 // Probe the stub cache. 2042 // Probe the stub cache.
2031 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( 2043 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags(
2032 Code::ComputeHandlerFlags(Code::LOAD_IC)); 2044 Code::ComputeHandlerFlags(Code::LOAD_IC));
2033 Add<HTailCallThroughMegamorphicCache>(receiver, name, flags); 2045 Add<HTailCallThroughMegamorphicCache>(receiver, name, flags);
2034 2046
2035 // We never continue. 2047 // We never continue.
2036 return graph()->GetConstant0(); 2048 return graph()->GetConstant0();
2037 } 2049 }
2038 } } // namespace v8::internal 2050 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698