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

Side by Side Diff: src/hydrogen.cc

Issue 181543002: Eliminate extended mode, and other modes clean-up (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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 | « src/hydrogen.h ('k') | src/hydrogen-instructions.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 } 1276 }
1277 1277
1278 1278
1279 HValue* HGraphBuilder::BuildWrapReceiver(HValue* object, HValue* function) { 1279 HValue* HGraphBuilder::BuildWrapReceiver(HValue* object, HValue* function) {
1280 if (object->type().IsJSObject()) return object; 1280 if (object->type().IsJSObject()) return object;
1281 if (function->IsConstant() && 1281 if (function->IsConstant() &&
1282 HConstant::cast(function)->handle(isolate())->IsJSFunction()) { 1282 HConstant::cast(function)->handle(isolate())->IsJSFunction()) {
1283 Handle<JSFunction> f = Handle<JSFunction>::cast( 1283 Handle<JSFunction> f = Handle<JSFunction>::cast(
1284 HConstant::cast(function)->handle(isolate())); 1284 HConstant::cast(function)->handle(isolate()));
1285 SharedFunctionInfo* shared = f->shared(); 1285 SharedFunctionInfo* shared = f->shared();
1286 if (!shared->is_sloppy_mode() || shared->native()) return object; 1286 if (shared->strict_mode() == STRICT || shared->native()) return object;
1287 } 1287 }
1288 return Add<HWrapReceiver>(object, function); 1288 return Add<HWrapReceiver>(object, function);
1289 } 1289 }
1290 1290
1291 1291
1292 HValue* HGraphBuilder::BuildCheckForCapacityGrow( 1292 HValue* HGraphBuilder::BuildCheckForCapacityGrow(
1293 HValue* object, 1293 HValue* object,
1294 HValue* elements, 1294 HValue* elements,
1295 ElementsKind kind, 1295 ElementsKind kind,
1296 HValue* length, 1296 HValue* length,
(...skipping 4298 matching lines...) Expand 10 before | Expand all | Expand 10 after
5595 builder_, access_type_, ToType(types->at(i)), name_); 5595 builder_, access_type_, ToType(types->at(i)), name_);
5596 if (!test_info.IsCompatible(this)) return false; 5596 if (!test_info.IsCompatible(this)) return false;
5597 } 5597 }
5598 5598
5599 return true; 5599 return true;
5600 } 5600 }
5601 5601
5602 5602
5603 static bool NeedsWrappingFor(Type* type, Handle<JSFunction> target) { 5603 static bool NeedsWrappingFor(Type* type, Handle<JSFunction> target) {
5604 return type->Is(Type::NumberOrString()) && 5604 return type->Is(Type::NumberOrString()) &&
5605 target->shared()->is_sloppy_mode() && 5605 target->shared()->strict_mode() == SLOPPY &&
5606 !target->shared()->native(); 5606 !target->shared()->native();
5607 } 5607 }
5608 5608
5609 5609
5610 HInstruction* HOptimizedGraphBuilder::BuildMonomorphicAccess( 5610 HInstruction* HOptimizedGraphBuilder::BuildMonomorphicAccess(
5611 PropertyAccessInfo* info, 5611 PropertyAccessInfo* info,
5612 HValue* object, 5612 HValue* object,
5613 HValue* checked_object, 5613 HValue* checked_object,
5614 HValue* value, 5614 HValue* value,
5615 BailoutId ast_id, 5615 BailoutId ast_id,
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
5929 Add<HStoreGlobalCell>(value, cell, lookup.GetPropertyDetails()); 5929 Add<HStoreGlobalCell>(value, cell, lookup.GetPropertyDetails());
5930 if (instr->HasObservableSideEffects()) { 5930 if (instr->HasObservableSideEffects()) {
5931 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); 5931 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
5932 } 5932 }
5933 } else { 5933 } else {
5934 HValue* global_object = Add<HLoadNamedField>( 5934 HValue* global_object = Add<HLoadNamedField>(
5935 context(), static_cast<HValue*>(NULL), 5935 context(), static_cast<HValue*>(NULL),
5936 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); 5936 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
5937 HStoreNamedGeneric* instr = 5937 HStoreNamedGeneric* instr =
5938 Add<HStoreNamedGeneric>(global_object, var->name(), 5938 Add<HStoreNamedGeneric>(global_object, var->name(),
5939 value, function_strict_mode_flag()); 5939 value, function_strict_mode());
5940 USE(instr); 5940 USE(instr);
5941 ASSERT(instr->HasObservableSideEffects()); 5941 ASSERT(instr->HasObservableSideEffects());
5942 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); 5942 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
5943 } 5943 }
5944 } 5944 }
5945 5945
5946 5946
5947 void HOptimizedGraphBuilder::HandleCompoundAssignment(Assignment* expr) { 5947 void HOptimizedGraphBuilder::HandleCompoundAssignment(Assignment* expr) {
5948 Expression* target = expr->target(); 5948 Expression* target = expr->target();
5949 VariableProxy* proxy = target->AsVariableProxy(); 5949 VariableProxy* proxy = target->AsVariableProxy();
(...skipping 14 matching lines...) Expand all
5964 5964
5965 switch (var->location()) { 5965 switch (var->location()) {
5966 case Variable::UNALLOCATED: 5966 case Variable::UNALLOCATED:
5967 HandleGlobalVariableAssignment(var, 5967 HandleGlobalVariableAssignment(var,
5968 Top(), 5968 Top(),
5969 expr->AssignmentId()); 5969 expr->AssignmentId());
5970 break; 5970 break;
5971 5971
5972 case Variable::PARAMETER: 5972 case Variable::PARAMETER:
5973 case Variable::LOCAL: 5973 case Variable::LOCAL:
5974 if (var->mode() == CONST) { 5974 if (var->mode() == CONST_LEGACY) {
5975 return Bailout(kUnsupportedConstCompoundAssignment); 5975 return Bailout(kUnsupportedConstCompoundAssignment);
5976 } 5976 }
5977 BindIfLive(var, Top()); 5977 BindIfLive(var, Top());
5978 break; 5978 break;
5979 5979
5980 case Variable::CONTEXT: { 5980 case Variable::CONTEXT: {
5981 // Bail out if we try to mutate a parameter value in a function 5981 // Bail out if we try to mutate a parameter value in a function
5982 // using the arguments object. We do not (yet) correctly handle the 5982 // using the arguments object. We do not (yet) correctly handle the
5983 // arguments property of the function. 5983 // arguments property of the function.
5984 if (current_info()->scope()->arguments() != NULL) { 5984 if (current_info()->scope()->arguments() != NULL) {
5985 // Parameters will be allocated to context slots. We have no 5985 // Parameters will be allocated to context slots. We have no
5986 // direct way to detect that the variable is a parameter so we do 5986 // direct way to detect that the variable is a parameter so we do
5987 // a linear search of the parameter variables. 5987 // a linear search of the parameter variables.
5988 int count = current_info()->scope()->num_parameters(); 5988 int count = current_info()->scope()->num_parameters();
5989 for (int i = 0; i < count; ++i) { 5989 for (int i = 0; i < count; ++i) {
5990 if (var == current_info()->scope()->parameter(i)) { 5990 if (var == current_info()->scope()->parameter(i)) {
5991 Bailout(kAssignmentToParameterFunctionUsesArgumentsObject); 5991 Bailout(kAssignmentToParameterFunctionUsesArgumentsObject);
5992 } 5992 }
5993 } 5993 }
5994 } 5994 }
5995 5995
5996 HStoreContextSlot::Mode mode; 5996 HStoreContextSlot::Mode mode;
5997 5997
5998 switch (var->mode()) { 5998 switch (var->mode()) {
5999 case LET: 5999 case LET:
6000 mode = HStoreContextSlot::kCheckDeoptimize; 6000 mode = HStoreContextSlot::kCheckDeoptimize;
6001 break; 6001 break;
6002 case CONST: 6002 case CONST:
6003 return ast_context()->ReturnValue(Pop());
6004 case CONST_HARMONY:
6005 // This case is checked statically so no need to 6003 // This case is checked statically so no need to
6006 // perform checks here 6004 // perform checks here
6007 UNREACHABLE(); 6005 UNREACHABLE();
6006 case CONST_LEGACY:
6007 return ast_context()->ReturnValue(Pop());
6008 default: 6008 default:
6009 mode = HStoreContextSlot::kNoCheck; 6009 mode = HStoreContextSlot::kNoCheck;
6010 } 6010 }
6011 6011
6012 HValue* context = BuildContextChainWalk(var); 6012 HValue* context = BuildContextChainWalk(var);
6013 HStoreContextSlot* instr = Add<HStoreContextSlot>( 6013 HStoreContextSlot* instr = Add<HStoreContextSlot>(
6014 context, var->index(), mode, Top()); 6014 context, var->index(), mode, Top());
6015 if (instr->HasObservableSideEffects()) { 6015 if (instr->HasObservableSideEffects()) {
6016 Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE); 6016 Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE);
6017 } 6017 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
6062 return; 6062 return;
6063 } 6063 }
6064 6064
6065 if (prop != NULL) { 6065 if (prop != NULL) {
6066 HandlePropertyAssignment(expr); 6066 HandlePropertyAssignment(expr);
6067 } else if (proxy != NULL) { 6067 } else if (proxy != NULL) {
6068 Variable* var = proxy->var(); 6068 Variable* var = proxy->var();
6069 6069
6070 if (var->mode() == CONST) { 6070 if (var->mode() == CONST) {
6071 if (expr->op() != Token::INIT_CONST) { 6071 if (expr->op() != Token::INIT_CONST) {
6072 return Bailout(kNonInitializerAssignmentToConst);
6073 }
6074 } else if (var->mode() == CONST_LEGACY) {
6075 if (expr->op() != Token::INIT_CONST_LEGACY) {
6072 CHECK_ALIVE(VisitForValue(expr->value())); 6076 CHECK_ALIVE(VisitForValue(expr->value()));
6073 return ast_context()->ReturnValue(Pop()); 6077 return ast_context()->ReturnValue(Pop());
6074 } 6078 }
6075 6079
6076 if (var->IsStackAllocated()) { 6080 if (var->IsStackAllocated()) {
6077 // We insert a use of the old value to detect unsupported uses of const 6081 // We insert a use of the old value to detect unsupported uses of const
6078 // variables (e.g. initialization inside a loop). 6082 // variables (e.g. initialization inside a loop).
6079 HValue* old_value = environment()->Lookup(var); 6083 HValue* old_value = environment()->Lookup(var);
6080 Add<HUseConst>(old_value); 6084 Add<HUseConst>(old_value);
6081 } 6085 }
6082 } else if (var->mode() == CONST_HARMONY) {
6083 if (expr->op() != Token::INIT_CONST_HARMONY) {
6084 return Bailout(kNonInitializerAssignmentToConst);
6085 }
6086 } 6086 }
6087 6087
6088 if (proxy->IsArguments()) return Bailout(kAssignmentToArguments); 6088 if (proxy->IsArguments()) return Bailout(kAssignmentToArguments);
6089 6089
6090 // Handle the assignment. 6090 // Handle the assignment.
6091 switch (var->location()) { 6091 switch (var->location()) {
6092 case Variable::UNALLOCATED: 6092 case Variable::UNALLOCATED:
6093 CHECK_ALIVE(VisitForValue(expr->value())); 6093 CHECK_ALIVE(VisitForValue(expr->value()));
6094 HandleGlobalVariableAssignment(var, 6094 HandleGlobalVariableAssignment(var,
6095 Top(), 6095 Top(),
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
6131 } 6131 }
6132 6132
6133 CHECK_ALIVE(VisitForValue(expr->value())); 6133 CHECK_ALIVE(VisitForValue(expr->value()));
6134 HStoreContextSlot::Mode mode; 6134 HStoreContextSlot::Mode mode;
6135 if (expr->op() == Token::ASSIGN) { 6135 if (expr->op() == Token::ASSIGN) {
6136 switch (var->mode()) { 6136 switch (var->mode()) {
6137 case LET: 6137 case LET:
6138 mode = HStoreContextSlot::kCheckDeoptimize; 6138 mode = HStoreContextSlot::kCheckDeoptimize;
6139 break; 6139 break;
6140 case CONST: 6140 case CONST:
6141 return ast_context()->ReturnValue(Pop());
6142 case CONST_HARMONY:
6143 // This case is checked statically so no need to 6141 // This case is checked statically so no need to
6144 // perform checks here 6142 // perform checks here
6145 UNREACHABLE(); 6143 UNREACHABLE();
6144 case CONST_LEGACY:
6145 return ast_context()->ReturnValue(Pop());
6146 default: 6146 default:
6147 mode = HStoreContextSlot::kNoCheck; 6147 mode = HStoreContextSlot::kNoCheck;
6148 } 6148 }
6149 } else if (expr->op() == Token::INIT_VAR || 6149 } else if (expr->op() == Token::INIT_VAR ||
6150 expr->op() == Token::INIT_LET || 6150 expr->op() == Token::INIT_LET ||
6151 expr->op() == Token::INIT_CONST_HARMONY) { 6151 expr->op() == Token::INIT_CONST) {
6152 mode = HStoreContextSlot::kNoCheck; 6152 mode = HStoreContextSlot::kNoCheck;
6153 } else { 6153 } else {
6154 ASSERT(expr->op() == Token::INIT_CONST); 6154 ASSERT(expr->op() == Token::INIT_CONST_LEGACY);
6155 6155
6156 mode = HStoreContextSlot::kCheckIgnoreAssignment; 6156 mode = HStoreContextSlot::kCheckIgnoreAssignment;
6157 } 6157 }
6158 6158
6159 HValue* context = BuildContextChainWalk(var); 6159 HValue* context = BuildContextChainWalk(var);
6160 HStoreContextSlot* instr = Add<HStoreContextSlot>( 6160 HStoreContextSlot* instr = Add<HStoreContextSlot>(
6161 context, var->index(), mode, Top()); 6161 context, var->index(), mode, Top());
6162 if (instr->HasObservableSideEffects()) { 6162 if (instr->HasObservableSideEffects()) {
6163 Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE); 6163 Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE);
6164 } 6164 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
6238 Handle<String> name, 6238 Handle<String> name,
6239 HValue* value, 6239 HValue* value,
6240 bool is_uninitialized) { 6240 bool is_uninitialized) {
6241 if (is_uninitialized) { 6241 if (is_uninitialized) {
6242 Add<HDeoptimize>("Insufficient type feedback for generic named access", 6242 Add<HDeoptimize>("Insufficient type feedback for generic named access",
6243 Deoptimizer::SOFT); 6243 Deoptimizer::SOFT);
6244 } 6244 }
6245 if (access_type == LOAD) { 6245 if (access_type == LOAD) {
6246 return New<HLoadNamedGeneric>(object, name); 6246 return New<HLoadNamedGeneric>(object, name);
6247 } else { 6247 } else {
6248 return New<HStoreNamedGeneric>( 6248 return New<HStoreNamedGeneric>(object, name, value, function_strict_mode());
6249 object, name, value, function_strict_mode_flag());
6250 } 6249 }
6251 } 6250 }
6252 6251
6253 6252
6254 6253
6255 HInstruction* HOptimizedGraphBuilder::BuildKeyedGeneric( 6254 HInstruction* HOptimizedGraphBuilder::BuildKeyedGeneric(
6256 PropertyAccessType access_type, 6255 PropertyAccessType access_type,
6257 HValue* object, 6256 HValue* object,
6258 HValue* key, 6257 HValue* key,
6259 HValue* value) { 6258 HValue* value) {
6260 if (access_type == LOAD) { 6259 if (access_type == LOAD) {
6261 return New<HLoadKeyedGeneric>(object, key); 6260 return New<HLoadKeyedGeneric>(object, key);
6262 } else { 6261 } else {
6263 return New<HStoreKeyedGeneric>( 6262 return New<HStoreKeyedGeneric>(object, key, value, function_strict_mode());
6264 object, key, value, function_strict_mode_flag());
6265 } 6263 }
6266 } 6264 }
6267 6265
6268 6266
6269 LoadKeyedHoleMode HOptimizedGraphBuilder::BuildKeyedHoleMode(Handle<Map> map) { 6267 LoadKeyedHoleMode HOptimizedGraphBuilder::BuildKeyedHoleMode(Handle<Map> map) {
6270 // Loads from a "stock" fast holey double arrays can elide the hole check. 6268 // Loads from a "stock" fast holey double arrays can elide the hole check.
6271 LoadKeyedHoleMode load_mode = NEVER_RETURN_HOLE; 6269 LoadKeyedHoleMode load_mode = NEVER_RETURN_HOLE;
6272 if (*map == isolate()->get_initial_js_array_map(FAST_HOLEY_DOUBLE_ELEMENTS) && 6270 if (*map == isolate()->get_initial_js_array_map(FAST_HOLEY_DOUBLE_ELEMENTS) &&
6273 isolate()->IsFastArrayConstructorPrototypeChainIntact()) { 6271 isolate()->IsFastArrayConstructorPrototypeChainIntact()) {
6274 Handle<JSObject> prototype(JSObject::cast(map->prototype()), isolate()); 6272 Handle<JSObject> prototype(JSObject::cast(map->prototype()), isolate());
(...skipping 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after
7942 Drop(1); // Function. 7940 Drop(1); // Function.
7943 ast_context()->ReturnInstruction(call, expr->id()); 7941 ast_context()->ReturnInstruction(call, expr->id());
7944 return true; 7942 return true;
7945 } 7943 }
7946 } 7944 }
7947 7945
7948 7946
7949 HValue* HOptimizedGraphBuilder::ImplicitReceiverFor(HValue* function, 7947 HValue* HOptimizedGraphBuilder::ImplicitReceiverFor(HValue* function,
7950 Handle<JSFunction> target) { 7948 Handle<JSFunction> target) {
7951 SharedFunctionInfo* shared = target->shared(); 7949 SharedFunctionInfo* shared = target->shared();
7952 if (shared->is_sloppy_mode() && !shared->native()) { 7950 if (shared->strict_mode() == SLOPPY && !shared->native()) {
7953 // Cannot embed a direct reference to the global proxy 7951 // Cannot embed a direct reference to the global proxy
7954 // as is it dropped on deserialization. 7952 // as is it dropped on deserialization.
7955 CHECK(!Serializer::enabled()); 7953 CHECK(!Serializer::enabled());
7956 Handle<JSObject> global_receiver( 7954 Handle<JSObject> global_receiver(
7957 target->context()->global_object()->global_receiver()); 7955 target->context()->global_object()->global_receiver());
7958 return Add<HConstant>(global_receiver); 7956 return Add<HConstant>(global_receiver);
7959 } 7957 }
7960 return graph()->GetConstantUndefined(); 7958 return graph()->GetConstantUndefined();
7961 } 7959 }
7962 7960
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
8659 Property* prop = expr->expression()->AsProperty(); 8657 Property* prop = expr->expression()->AsProperty();
8660 VariableProxy* proxy = expr->expression()->AsVariableProxy(); 8658 VariableProxy* proxy = expr->expression()->AsVariableProxy();
8661 if (prop != NULL) { 8659 if (prop != NULL) {
8662 CHECK_ALIVE(VisitForValue(prop->obj())); 8660 CHECK_ALIVE(VisitForValue(prop->obj()));
8663 CHECK_ALIVE(VisitForValue(prop->key())); 8661 CHECK_ALIVE(VisitForValue(prop->key()));
8664 HValue* key = Pop(); 8662 HValue* key = Pop();
8665 HValue* obj = Pop(); 8663 HValue* obj = Pop();
8666 HValue* function = AddLoadJSBuiltin(Builtins::DELETE); 8664 HValue* function = AddLoadJSBuiltin(Builtins::DELETE);
8667 Add<HPushArgument>(obj); 8665 Add<HPushArgument>(obj);
8668 Add<HPushArgument>(key); 8666 Add<HPushArgument>(key);
8669 Add<HPushArgument>(Add<HConstant>(function_strict_mode_flag())); 8667 Add<HPushArgument>(Add<HConstant>(function_strict_mode()));
8670 // TODO(olivf) InvokeFunction produces a check for the parameter count, 8668 // TODO(olivf) InvokeFunction produces a check for the parameter count,
8671 // even though we are certain to pass the correct number of arguments here. 8669 // even though we are certain to pass the correct number of arguments here.
8672 HInstruction* instr = New<HInvokeFunction>(function, 3); 8670 HInstruction* instr = New<HInvokeFunction>(function, 3);
8673 return ast_context()->ReturnInstruction(instr, expr->id()); 8671 return ast_context()->ReturnInstruction(instr, expr->id());
8674 } else if (proxy != NULL) { 8672 } else if (proxy != NULL) {
8675 Variable* var = proxy->var(); 8673 Variable* var = proxy->var();
8676 if (var->IsUnallocated()) { 8674 if (var->IsUnallocated()) {
8677 Bailout(kDeleteWithGlobalVariable); 8675 Bailout(kDeleteWithGlobalVariable);
8678 } else if (var->IsStackAllocated() || var->IsContextSlot()) { 8676 } else if (var->IsStackAllocated() || var->IsContextSlot()) {
8679 // Result of deleting non-global variables is false. 'this' is not 8677 // Result of deleting non-global variables is false. 'this' is not
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
8823 // Match the full code generator stack by simulating an extra stack 8821 // Match the full code generator stack by simulating an extra stack
8824 // element for postfix operations in a non-effect context. The return 8822 // element for postfix operations in a non-effect context. The return
8825 // value is ToNumber(input). 8823 // value is ToNumber(input).
8826 bool returns_original_input = 8824 bool returns_original_input =
8827 expr->is_postfix() && !ast_context()->IsEffect(); 8825 expr->is_postfix() && !ast_context()->IsEffect();
8828 HValue* input = NULL; // ToNumber(original_input). 8826 HValue* input = NULL; // ToNumber(original_input).
8829 HValue* after = NULL; // The result after incrementing or decrementing. 8827 HValue* after = NULL; // The result after incrementing or decrementing.
8830 8828
8831 if (proxy != NULL) { 8829 if (proxy != NULL) {
8832 Variable* var = proxy->var(); 8830 Variable* var = proxy->var();
8833 if (var->mode() == CONST) { 8831 if (var->mode() == CONST_LEGACY) {
8834 return Bailout(kUnsupportedCountOperationWithConst); 8832 return Bailout(kUnsupportedCountOperationWithConst);
8835 } 8833 }
8836 // Argument of the count operation is a variable, not a property. 8834 // Argument of the count operation is a variable, not a property.
8837 ASSERT(prop == NULL); 8835 ASSERT(prop == NULL);
8838 CHECK_ALIVE(VisitForValue(target)); 8836 CHECK_ALIVE(VisitForValue(target));
8839 8837
8840 after = BuildIncrement(returns_original_input, expr); 8838 after = BuildIncrement(returns_original_input, expr);
8841 input = returns_original_input ? Top() : Pop(); 8839 input = returns_original_input ? Top() : Pop();
8842 Push(after); 8840 Push(after);
8843 8841
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after
10031 void HOptimizedGraphBuilder::VisitDeclarations( 10029 void HOptimizedGraphBuilder::VisitDeclarations(
10032 ZoneList<Declaration*>* declarations) { 10030 ZoneList<Declaration*>* declarations) {
10033 ASSERT(globals_.is_empty()); 10031 ASSERT(globals_.is_empty());
10034 AstVisitor::VisitDeclarations(declarations); 10032 AstVisitor::VisitDeclarations(declarations);
10035 if (!globals_.is_empty()) { 10033 if (!globals_.is_empty()) {
10036 Handle<FixedArray> array = 10034 Handle<FixedArray> array =
10037 isolate()->factory()->NewFixedArray(globals_.length(), TENURED); 10035 isolate()->factory()->NewFixedArray(globals_.length(), TENURED);
10038 for (int i = 0; i < globals_.length(); ++i) array->set(i, *globals_.at(i)); 10036 for (int i = 0; i < globals_.length(); ++i) array->set(i, *globals_.at(i));
10039 int flags = DeclareGlobalsEvalFlag::encode(current_info()->is_eval()) | 10037 int flags = DeclareGlobalsEvalFlag::encode(current_info()->is_eval()) |
10040 DeclareGlobalsNativeFlag::encode(current_info()->is_native()) | 10038 DeclareGlobalsNativeFlag::encode(current_info()->is_native()) |
10041 DeclareGlobalsLanguageMode::encode(current_info()->language_mode()); 10039 DeclareGlobalsStrictMode::encode(current_info()->strict_mode());
10042 Add<HDeclareGlobals>(array, flags); 10040 Add<HDeclareGlobals>(array, flags);
10043 globals_.Clear(); 10041 globals_.Clear();
10044 } 10042 }
10045 } 10043 }
10046 10044
10047 10045
10048 void HOptimizedGraphBuilder::VisitVariableDeclaration( 10046 void HOptimizedGraphBuilder::VisitVariableDeclaration(
10049 VariableDeclaration* declaration) { 10047 VariableDeclaration* declaration) {
10050 VariableProxy* proxy = declaration->proxy(); 10048 VariableProxy* proxy = declaration->proxy();
10051 VariableMode mode = declaration->mode(); 10049 VariableMode mode = declaration->mode();
10052 Variable* variable = proxy->var(); 10050 Variable* variable = proxy->var();
10053 bool hole_init = mode == CONST || mode == CONST_HARMONY || mode == LET; 10051 bool hole_init = mode == LET || mode == CONST || mode == CONST_LEGACY;
10054 switch (variable->location()) { 10052 switch (variable->location()) {
10055 case Variable::UNALLOCATED: 10053 case Variable::UNALLOCATED:
10056 globals_.Add(variable->name(), zone()); 10054 globals_.Add(variable->name(), zone());
10057 globals_.Add(variable->binding_needs_init() 10055 globals_.Add(variable->binding_needs_init()
10058 ? isolate()->factory()->the_hole_value() 10056 ? isolate()->factory()->the_hole_value()
10059 : isolate()->factory()->undefined_value(), zone()); 10057 : isolate()->factory()->undefined_value(), zone());
10060 return; 10058 return;
10061 case Variable::PARAMETER: 10059 case Variable::PARAMETER:
10062 case Variable::LOCAL: 10060 case Variable::LOCAL:
10063 if (hole_init) { 10061 if (hole_init) {
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
11292 if (ShouldProduceTraceOutput()) { 11290 if (ShouldProduceTraceOutput()) {
11293 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11291 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11294 } 11292 }
11295 11293
11296 #ifdef DEBUG 11294 #ifdef DEBUG
11297 graph_->Verify(false); // No full verify. 11295 graph_->Verify(false); // No full verify.
11298 #endif 11296 #endif
11299 } 11297 }
11300 11298
11301 } } // namespace v8::internal 11299 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698