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

Side by Side Diff: src/hydrogen.cc

Issue 35413007: HCheckInstanceType factories unified (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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 | « no previous file | 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 5942 matching lines...) Expand 10 before | Expand all | Expand 10 after
5953 PropertyAccessInfo info(isolate(), types->first(), name); 5953 PropertyAccessInfo info(isolate(), types->first(), name);
5954 if (!info.CanLoadAsMonomorphic(types)) { 5954 if (!info.CanLoadAsMonomorphic(types)) {
5955 return HandlePolymorphicLoadNamedField( 5955 return HandlePolymorphicLoadNamedField(
5956 ast_id, expr->LoadId(), object, types, name); 5956 ast_id, expr->LoadId(), object, types, name);
5957 } 5957 }
5958 5958
5959 BuildCheckHeapObject(object); 5959 BuildCheckHeapObject(object);
5960 HInstruction* checked_object; 5960 HInstruction* checked_object;
5961 if (AreStringTypes(types)) { 5961 if (AreStringTypes(types)) {
5962 checked_object = 5962 checked_object =
5963 AddInstruction(HCheckInstanceType::NewIsString(object, zone())); 5963 Add<HCheckInstanceType>(object, HCheckInstanceType::IS_STRING);
5964 } else { 5964 } else {
5965 checked_object = Add<HCheckMaps>(object, types); 5965 checked_object = Add<HCheckMaps>(object, types);
5966 } 5966 }
5967 instr = BuildLoadMonomorphic( 5967 instr = BuildLoadMonomorphic(
5968 &info, object, checked_object, ast_id, expr->LoadId()); 5968 &info, object, checked_object, ast_id, expr->LoadId());
5969 if (instr == NULL) return; 5969 if (instr == NULL) return;
5970 if (instr->IsLinked()) return ast_context()->ReturnValue(instr); 5970 if (instr->IsLinked()) return ast_context()->ReturnValue(instr);
5971 } else { 5971 } else {
5972 instr = BuildLoadNamedGeneric(object, name, expr); 5972 instr = BuildLoadNamedGeneric(object, name, expr);
5973 } 5973 }
(...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after
7635 int32_t i = c_index->NumberValueAsInteger32(); 7635 int32_t i = c_index->NumberValueAsInteger32();
7636 Handle<String> s = c_string->StringValue(); 7636 Handle<String> s = c_string->StringValue();
7637 if (i < 0 || i >= s->length()) { 7637 if (i < 0 || i >= s->length()) {
7638 return New<HConstant>(OS::nan_value()); 7638 return New<HConstant>(OS::nan_value());
7639 } 7639 }
7640 return New<HConstant>(s->Get(i)); 7640 return New<HConstant>(s->Get(i));
7641 } 7641 }
7642 } 7642 }
7643 BuildCheckHeapObject(string); 7643 BuildCheckHeapObject(string);
7644 HValue* checkstring = 7644 HValue* checkstring =
7645 AddInstruction(HCheckInstanceType::NewIsString(string, zone())); 7645 Add<HCheckInstanceType>(string, HCheckInstanceType::IS_STRING);
7646 HInstruction* length = BuildLoadStringLength(string, checkstring); 7646 HInstruction* length = BuildLoadStringLength(string, checkstring);
7647 AddInstruction(length); 7647 AddInstruction(length);
7648 HInstruction* checked_index = Add<HBoundsCheck>(index, length); 7648 HInstruction* checked_index = Add<HBoundsCheck>(index, length);
7649 return New<HStringCharCodeAt>(string, checked_index); 7649 return New<HStringCharCodeAt>(string, checked_index);
7650 } 7650 }
7651 7651
7652 7652
7653 // Checks if the given shift amounts have following forms: 7653 // Checks if the given shift amounts have following forms:
7654 // (N1) and (N2) with N1 + N2 = 32; (sa) and (32 - sa). 7654 // (N1) and (N2) with N1 + N2 = 32; (sa) and (32 - sa).
7655 static bool ShiftAmountsAllowReplaceByRotate(HValue* sa, 7655 static bool ShiftAmountsAllowReplaceByRotate(HValue* sa,
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
8238 // Can we get away with map check and not instance type check? 8238 // Can we get away with map check and not instance type check?
8239 if (combined_type->IsClass()) { 8239 if (combined_type->IsClass()) {
8240 Handle<Map> map = combined_type->AsClass(); 8240 Handle<Map> map = combined_type->AsClass();
8241 AddCheckMap(left, map); 8241 AddCheckMap(left, map);
8242 AddCheckMap(right, map); 8242 AddCheckMap(right, map);
8243 HCompareObjectEqAndBranch* result = 8243 HCompareObjectEqAndBranch* result =
8244 New<HCompareObjectEqAndBranch>(left, right); 8244 New<HCompareObjectEqAndBranch>(left, right);
8245 return ast_context()->ReturnControl(result, expr->id()); 8245 return ast_context()->ReturnControl(result, expr->id());
8246 } else { 8246 } else {
8247 BuildCheckHeapObject(left); 8247 BuildCheckHeapObject(left);
8248 AddInstruction(HCheckInstanceType::NewIsSpecObject(left, zone())); 8248 Add<HCheckInstanceType>(left, HCheckInstanceType::IS_SPEC_OBJECT);
8249 BuildCheckHeapObject(right); 8249 BuildCheckHeapObject(right);
8250 AddInstruction(HCheckInstanceType::NewIsSpecObject(right, zone())); 8250 Add<HCheckInstanceType>(right, HCheckInstanceType::IS_SPEC_OBJECT);
8251 HCompareObjectEqAndBranch* result = 8251 HCompareObjectEqAndBranch* result =
8252 New<HCompareObjectEqAndBranch>(left, right); 8252 New<HCompareObjectEqAndBranch>(left, right);
8253 return ast_context()->ReturnControl(result, expr->id()); 8253 return ast_context()->ReturnControl(result, expr->id());
8254 } 8254 }
8255 } 8255 }
8256 default: 8256 default:
8257 return Bailout(kUnsupportedNonPrimitiveCompare); 8257 return Bailout(kUnsupportedNonPrimitiveCompare);
8258 } 8258 }
8259 } else if (combined_type->Is(Type::InternalizedString()) && 8259 } else if (combined_type->Is(Type::InternalizedString()) &&
8260 Token::IsEqualityOp(op)) { 8260 Token::IsEqualityOp(op)) {
8261 BuildCheckHeapObject(left); 8261 BuildCheckHeapObject(left);
8262 AddInstruction(HCheckInstanceType::NewIsInternalizedString(left, zone())); 8262 Add<HCheckInstanceType>(left, HCheckInstanceType::IS_INTERNALIZED_STRING);
8263 BuildCheckHeapObject(right); 8263 BuildCheckHeapObject(right);
8264 AddInstruction(HCheckInstanceType::NewIsInternalizedString(right, zone())); 8264 Add<HCheckInstanceType>(right, HCheckInstanceType::IS_INTERNALIZED_STRING);
8265 HCompareObjectEqAndBranch* result = 8265 HCompareObjectEqAndBranch* result =
8266 New<HCompareObjectEqAndBranch>(left, right); 8266 New<HCompareObjectEqAndBranch>(left, right);
8267 return ast_context()->ReturnControl(result, expr->id()); 8267 return ast_context()->ReturnControl(result, expr->id());
8268 } else if (combined_type->Is(Type::String())) { 8268 } else if (combined_type->Is(Type::String())) {
8269 BuildCheckHeapObject(left); 8269 BuildCheckHeapObject(left);
8270 AddInstruction(HCheckInstanceType::NewIsString(left, zone())); 8270 Add<HCheckInstanceType>(left, HCheckInstanceType::IS_STRING);
8271 BuildCheckHeapObject(right); 8271 BuildCheckHeapObject(right);
8272 AddInstruction(HCheckInstanceType::NewIsString(right, zone())); 8272 Add<HCheckInstanceType>(right, HCheckInstanceType::IS_STRING);
8273 HStringCompareAndBranch* result = 8273 HStringCompareAndBranch* result =
8274 New<HStringCompareAndBranch>(left, right, op); 8274 New<HStringCompareAndBranch>(left, right, op);
8275 return ast_context()->ReturnControl(result, expr->id()); 8275 return ast_context()->ReturnControl(result, expr->id());
8276 } else { 8276 } else {
8277 if (combined_rep.IsTagged() || combined_rep.IsNone()) { 8277 if (combined_rep.IsTagged() || combined_rep.IsNone()) {
8278 HCompareGeneric* result = New<HCompareGeneric>(left, right, op); 8278 HCompareGeneric* result = New<HCompareGeneric>(left, right, op);
8279 result->set_observed_input_representation(1, left_rep); 8279 result->set_observed_input_representation(1, left_rep);
8280 result->set_observed_input_representation(2, right_rep); 8280 result->set_observed_input_representation(2, right_rep);
8281 return ast_context()->ReturnInstruction(result, expr->id()); 8281 return ast_context()->ReturnInstruction(result, expr->id());
8282 } else { 8282 } else {
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after
9816 if (ShouldProduceTraceOutput()) { 9816 if (ShouldProduceTraceOutput()) {
9817 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9817 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9818 } 9818 }
9819 9819
9820 #ifdef DEBUG 9820 #ifdef DEBUG
9821 graph_->Verify(false); // No full verify. 9821 graph_->Verify(false); // No full verify.
9822 #endif 9822 #endif
9823 } 9823 }
9824 9824
9825 } } // namespace v8::internal 9825 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698