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

Side by Side Diff: src/full-codegen.cc

Issue 1222203007: Use FullCodeGenerator::EmitGlobalVariableLoad() where possible to avoid code duplication. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebasing Created 5 years, 5 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
« no previous file with comments | « src/full-codegen.h ('k') | src/ia32/full-codegen-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 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/ast.h" 7 #include "src/ast.h"
8 #include "src/ast-numbering.h" 8 #include "src/ast-numbering.h"
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 void FullCodeGenerator::CallLoadIC(ContextualMode contextual_mode, 208 void FullCodeGenerator::CallLoadIC(ContextualMode contextual_mode,
209 LanguageMode language_mode, 209 LanguageMode language_mode,
210 TypeFeedbackId id) { 210 TypeFeedbackId id) {
211 Handle<Code> ic = 211 Handle<Code> ic =
212 CodeFactory::LoadIC(isolate(), contextual_mode, language_mode).code(); 212 CodeFactory::LoadIC(isolate(), contextual_mode, language_mode).code();
213 CallIC(ic, id); 213 CallIC(ic, id);
214 } 214 }
215 215
216 216
217 void FullCodeGenerator::CallGlobalLoadIC(Handle<String> name) {
218 return CallLoadIC(CONTEXTUAL);
219 }
220
221
222 void FullCodeGenerator::CallStoreIC(TypeFeedbackId id) { 217 void FullCodeGenerator::CallStoreIC(TypeFeedbackId id) {
223 Handle<Code> ic = CodeFactory::StoreIC(isolate(), language_mode()).code(); 218 Handle<Code> ic = CodeFactory::StoreIC(isolate(), language_mode()).code();
224 CallIC(ic, id); 219 CallIC(ic, id);
225 } 220 }
226 221
227 222
228 void FullCodeGenerator::RecordJSReturnSite(Call* call) { 223 void FullCodeGenerator::RecordJSReturnSite(Call* call) {
229 // We record the offset of the function return so we can rebuild the frame 224 // We record the offset of the function return so we can rebuild the frame
230 // if the function was inlined, i.e., this is the return address in the 225 // if the function was inlined, i.e., this is the return address in the
231 // inlined function's frame. 226 // inlined function's frame.
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 600
606 SetExpressionPosition(expr); 601 SetExpressionPosition(expr);
607 if (ShouldInlineSmiCase(op)) { 602 if (ShouldInlineSmiCase(op)) {
608 EmitInlineSmiBinaryOp(expr, op, left, right); 603 EmitInlineSmiBinaryOp(expr, op, left, right);
609 } else { 604 } else {
610 EmitBinaryOp(expr, op); 605 EmitBinaryOp(expr, op);
611 } 606 }
612 } 607 }
613 608
614 609
610 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
611 VariableProxy* proxy = expr->AsVariableProxy();
612 DCHECK(!context()->IsEffect());
613 DCHECK(!context()->IsTest());
614
615 if (proxy != NULL && (proxy->var()->IsUnallocatedOrGlobalSlot() ||
616 proxy->var()->IsLookupSlot())) {
617 EmitVariableLoad(proxy, INSIDE_TYPEOF);
618 PrepareForBailout(proxy, TOS_REG);
619 } else {
620 // This expression cannot throw a reference error at the top level.
621 VisitInDuplicateContext(expr);
622 }
623 }
624
625
615 void FullCodeGenerator::VisitBlock(Block* stmt) { 626 void FullCodeGenerator::VisitBlock(Block* stmt) {
616 Comment cmnt(masm_, "[ Block"); 627 Comment cmnt(masm_, "[ Block");
617 NestedBlock nested_block(this, stmt); 628 NestedBlock nested_block(this, stmt);
618 SetStatementPosition(stmt); 629 SetStatementPosition(stmt);
619 630
620 { 631 {
621 EnterBlockScopeIfNeeded block_scope_state( 632 EnterBlockScopeIfNeeded block_scope_state(
622 this, stmt->scope(), stmt->EntryId(), stmt->DeclsId(), stmt->ExitId()); 633 this, stmt->scope(), stmt->EntryId(), stmt->DeclsId(), stmt->ExitId());
623 VisitStatements(stmt->statements()); 634 VisitStatements(stmt->statements());
624 __ bind(nested_block.break_label()); 635 __ bind(nested_block.break_label());
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS); 1445 codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS);
1435 codegen_->scope_ = saved_scope_; 1446 codegen_->scope_ = saved_scope_;
1436 } 1447 }
1437 1448
1438 1449
1439 #undef __ 1450 #undef __
1440 1451
1441 1452
1442 } // namespace internal 1453 } // namespace internal
1443 } // namespace v8 1454 } // namespace v8
OLDNEW
« no previous file with comments | « src/full-codegen.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698