| OLD | NEW | 
|---|
| 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 234 } | 234 } | 
| 235 | 235 | 
| 236 | 236 | 
| 237 bool FunctionLiteral::NeedsHomeObject(Expression* expr) { | 237 bool FunctionLiteral::NeedsHomeObject(Expression* expr) { | 
| 238   if (expr == nullptr || !expr->IsFunctionLiteral()) return false; | 238   if (expr == nullptr || !expr->IsFunctionLiteral()) return false; | 
| 239   DCHECK_NOT_NULL(expr->AsFunctionLiteral()->scope()); | 239   DCHECK_NOT_NULL(expr->AsFunctionLiteral()->scope()); | 
| 240   return expr->AsFunctionLiteral()->scope()->NeedsHomeObject(); | 240   return expr->AsFunctionLiteral()->scope()->NeedsHomeObject(); | 
| 241 } | 241 } | 
| 242 | 242 | 
| 243 | 243 | 
|  | 244 // Helper to find an existing shared function info in the baseline code for the | 
|  | 245 // given function literal. Used to canonicalize SharedFunctionInfo objects. | 
|  | 246 void FunctionLiteral::InitializeSharedInfo( | 
|  | 247     Handle<Code> unoptimized_code) { | 
|  | 248   for (RelocIterator it(*unoptimized_code); !it.done(); it.next()) { | 
|  | 249     RelocInfo* rinfo = it.rinfo(); | 
|  | 250     if (rinfo->rmode() != RelocInfo::EMBEDDED_OBJECT) continue; | 
|  | 251     Object* obj = rinfo->target_object(); | 
|  | 252     if (obj->IsSharedFunctionInfo()) { | 
|  | 253       SharedFunctionInfo* shared = SharedFunctionInfo::cast(obj); | 
|  | 254       if (shared->start_position() == start_position()) { | 
|  | 255         shared_info_ = Handle<SharedFunctionInfo>(shared); | 
|  | 256         break; | 
|  | 257       } | 
|  | 258     } | 
|  | 259   } | 
|  | 260 } | 
|  | 261 | 
|  | 262 | 
| 244 ObjectLiteralProperty::ObjectLiteralProperty(Expression* key, Expression* value, | 263 ObjectLiteralProperty::ObjectLiteralProperty(Expression* key, Expression* value, | 
| 245                                              Kind kind, bool is_static, | 264                                              Kind kind, bool is_static, | 
| 246                                              bool is_computed_name) | 265                                              bool is_computed_name) | 
| 247     : key_(key), | 266     : key_(key), | 
| 248       value_(value), | 267       value_(value), | 
| 249       kind_(kind), | 268       kind_(kind), | 
| 250       emit_store_(true), | 269       emit_store_(true), | 
| 251       is_static_(is_static), | 270       is_static_(is_static), | 
| 252       is_computed_name_(is_computed_name) {} | 271       is_computed_name_(is_computed_name) {} | 
| 253 | 272 | 
| (...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1143 bool Literal::Match(void* literal1, void* literal2) { | 1162 bool Literal::Match(void* literal1, void* literal2) { | 
| 1144   const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1163   const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 
| 1145   const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1164   const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 
| 1146   return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 1165   return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 
| 1147          (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1166          (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 
| 1148 } | 1167 } | 
| 1149 | 1168 | 
| 1150 | 1169 | 
| 1151 }  // namespace internal | 1170 }  // namespace internal | 
| 1152 }  // namespace v8 | 1171 }  // namespace v8 | 
| OLD | NEW | 
|---|