OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 6123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6134 return ast_context()->ReturnInstruction(result, expr->id()); | 6134 return ast_context()->ReturnInstruction(result, expr->id()); |
6135 } | 6135 } |
6136 } else if (op == Token::IN) { | 6136 } else if (op == Token::IN) { |
6137 HIn* result = new(zone()) HIn(context, left, right); | 6137 HIn* result = new(zone()) HIn(context, left, right); |
6138 result->set_position(expr->position()); | 6138 result->set_position(expr->position()); |
6139 return ast_context()->ReturnInstruction(result, expr->id()); | 6139 return ast_context()->ReturnInstruction(result, expr->id()); |
6140 } else if (type_info.IsNonPrimitive()) { | 6140 } else if (type_info.IsNonPrimitive()) { |
6141 switch (op) { | 6141 switch (op) { |
6142 case Token::EQ: | 6142 case Token::EQ: |
6143 case Token::EQ_STRICT: { | 6143 case Token::EQ_STRICT: { |
6144 // Can we get away with map check and not instance type check? | 6144 AddInstruction(new(zone()) HCheckNonSmi(left)); |
6145 Handle<Map> map = oracle()->GetCompareMap(expr); | 6145 AddInstruction(HCheckInstanceType::NewIsSpecObject(left)); |
6146 if (!map.is_null()) { | 6146 AddInstruction(new(zone()) HCheckNonSmi(right)); |
6147 AddInstruction(new(zone()) HCheckNonSmi(left)); | 6147 AddInstruction(HCheckInstanceType::NewIsSpecObject(right)); |
6148 AddInstruction(new(zone()) HCheckMap(left, map)); | 6148 HCompareObjectEqAndBranch* result = |
6149 AddInstruction(new(zone()) HCheckNonSmi(right)); | 6149 new(zone()) HCompareObjectEqAndBranch(left, right); |
6150 AddInstruction(new(zone()) HCheckMap(right, map)); | 6150 result->set_position(expr->position()); |
6151 HCompareObjectEqAndBranch* result = | 6151 return ast_context()->ReturnControl(result, expr->id()); |
6152 new(zone()) HCompareObjectEqAndBranch(left, right); | |
6153 result->set_position(expr->position()); | |
6154 return ast_context()->ReturnControl(result, expr->id()); | |
6155 } else { | |
6156 AddInstruction(new(zone()) HCheckNonSmi(left)); | |
6157 AddInstruction(HCheckInstanceType::NewIsSpecObject(left)); | |
6158 AddInstruction(new(zone()) HCheckNonSmi(right)); | |
6159 AddInstruction(HCheckInstanceType::NewIsSpecObject(right)); | |
6160 HCompareObjectEqAndBranch* result = | |
6161 new(zone()) HCompareObjectEqAndBranch(left, right); | |
6162 result->set_position(expr->position()); | |
6163 return ast_context()->ReturnControl(result, expr->id()); | |
6164 } | |
6165 } | 6152 } |
6166 default: | 6153 default: |
6167 return Bailout("Unsupported non-primitive compare"); | 6154 return Bailout("Unsupported non-primitive compare"); |
6168 } | 6155 } |
6169 } else if (type_info.IsString() && oracle()->IsSymbolCompare(expr) && | 6156 } else if (type_info.IsString() && oracle()->IsSymbolCompare(expr) && |
6170 (op == Token::EQ || op == Token::EQ_STRICT)) { | 6157 (op == Token::EQ || op == Token::EQ_STRICT)) { |
6171 AddInstruction(new(zone()) HCheckNonSmi(left)); | 6158 AddInstruction(new(zone()) HCheckNonSmi(left)); |
6172 AddInstruction(HCheckInstanceType::NewIsSymbol(left)); | 6159 AddInstruction(HCheckInstanceType::NewIsSymbol(left)); |
6173 AddInstruction(new(zone()) HCheckNonSmi(right)); | 6160 AddInstruction(new(zone()) HCheckNonSmi(right)); |
6174 AddInstruction(HCheckInstanceType::NewIsSymbol(right)); | 6161 AddInstruction(HCheckInstanceType::NewIsSymbol(right)); |
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7261 } | 7248 } |
7262 } | 7249 } |
7263 | 7250 |
7264 #ifdef DEBUG | 7251 #ifdef DEBUG |
7265 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 7252 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
7266 if (allocator_ != NULL) allocator_->Verify(); | 7253 if (allocator_ != NULL) allocator_->Verify(); |
7267 #endif | 7254 #endif |
7268 } | 7255 } |
7269 | 7256 |
7270 } } // namespace v8::internal | 7257 } } // namespace v8::internal |
OLD | NEW |