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

Side by Side Diff: src/ast.cc

Issue 762123002: Remove duplicate code for searching SharedFunctionInfo. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | src/compiler/ast-graph-builder.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/ast.h" 5 #include "src/ast.h"
6 6
7 #include <cmath> // For isfinite. 7 #include <cmath> // For isfinite.
8 #include "src/builtins.h" 8 #include "src/builtins.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/contexts.h" 10 #include "src/contexts.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 return scope()->strict_mode(); 150 return scope()->strict_mode();
151 } 151 }
152 152
153 153
154 bool FunctionLiteral::uses_super() const { 154 bool FunctionLiteral::uses_super() const {
155 DCHECK_NOT_NULL(scope()); 155 DCHECK_NOT_NULL(scope());
156 return scope()->uses_super() || scope()->inner_uses_super(); 156 return scope()->uses_super() || scope()->inner_uses_super();
157 } 157 }
158 158
159 159
160 // Helper to find an existing shared function info in the baseline code for the
161 // given function literal. Used to canonicalize SharedFunctionInfo objects.
160 void FunctionLiteral::InitializeSharedInfo( 162 void FunctionLiteral::InitializeSharedInfo(
161 Handle<Code> unoptimized_code) { 163 Handle<Code> unoptimized_code) {
162 for (RelocIterator it(*unoptimized_code); !it.done(); it.next()) { 164 for (RelocIterator it(*unoptimized_code); !it.done(); it.next()) {
163 RelocInfo* rinfo = it.rinfo(); 165 RelocInfo* rinfo = it.rinfo();
164 if (rinfo->rmode() != RelocInfo::EMBEDDED_OBJECT) continue; 166 if (rinfo->rmode() != RelocInfo::EMBEDDED_OBJECT) continue;
165 Object* obj = rinfo->target_object(); 167 Object* obj = rinfo->target_object();
166 if (obj->IsSharedFunctionInfo()) { 168 if (obj->IsSharedFunctionInfo()) {
167 SharedFunctionInfo* shared = SharedFunctionInfo::cast(obj); 169 SharedFunctionInfo* shared = SharedFunctionInfo::cast(obj);
168 if (shared->start_position() == start_position()) { 170 if (shared->start_position() == start_position()) {
169 shared_info_ = Handle<SharedFunctionInfo>(shared); 171 shared_info_ = Handle<SharedFunctionInfo>(shared);
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 // static 1019 // static
1018 bool Literal::Match(void* literal1, void* literal2) { 1020 bool Literal::Match(void* literal1, void* literal2) {
1019 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); 1021 const AstValue* x = static_cast<Literal*>(literal1)->raw_value();
1020 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); 1022 const AstValue* y = static_cast<Literal*>(literal2)->raw_value();
1021 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || 1023 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) ||
1022 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); 1024 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
1023 } 1025 }
1024 1026
1025 1027
1026 } } // namespace v8::internal 1028 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698