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/arm/lithium-codegen-arm.cc

Issue 9015020: Make sure transitioned arrays efficiently call builtin Array functions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Tweaks Created 8 years, 11 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2012 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
11 // with the distribution. 11 // with the distribution.
(...skipping 4136 matching lines...) Expand 10 before | Expand all | Expand 10 after
4148 __ mov(ip, Operand(Handle<Object>(cell))); 4148 __ mov(ip, Operand(Handle<Object>(cell)));
4149 __ ldr(ip, FieldMemOperand(ip, JSGlobalPropertyCell::kValueOffset)); 4149 __ ldr(ip, FieldMemOperand(ip, JSGlobalPropertyCell::kValueOffset));
4150 __ cmp(reg, ip); 4150 __ cmp(reg, ip);
4151 } else { 4151 } else {
4152 __ cmp(reg, Operand(target)); 4152 __ cmp(reg, Operand(target));
4153 } 4153 }
4154 DeoptimizeIf(ne, instr->environment()); 4154 DeoptimizeIf(ne, instr->environment());
4155 } 4155 }
4156 4156
4157 4157
4158 void LCodeGen::DoCheckMapCommon(Register reg,
4159 Register scratch,
4160 Handle<Map> map,
4161 MapCheckMode mode,
4162 LEnvironment* env) {
4163 Label success;
4164 __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset));
4165 __ mov(ip, Operand(map));
4166 __ cmp(scratch, ip);
4167 if (mode == ALLOW_ELEMENT_TRANSITION_MAPS) {
4168 bool ignore;
4169 Map* transitioned_double_map =
4170 map->LookupElementsTransitionMap(FAST_DOUBLE_ELEMENTS, &ignore);
4171 ASSERT(transitioned_double_map == NULL ||
4172 map->elements_kind() == FAST_SMI_ONLY_ELEMENTS);
4173 Map* transitioned_fast_element_map =
4174 map->LookupElementsTransitionMap(FAST_ELEMENTS, &ignore);
4175 ASSERT(transitioned_fast_element_map == NULL ||
4176 map->elements_kind() != FAST_ELEMENTS);
4177 if (transitioned_fast_element_map != NULL) {
4178 __ b(eq, &success);
4179 __ cmp(scratch, Operand(Handle<Map>(transitioned_fast_element_map)));
4180 }
4181
4182 if (transitioned_double_map != NULL) {
4183 __ b(eq, &success);
4184 __ cmp(scratch, Operand(Handle<Map>(transitioned_double_map)));
4185 }
4186 }
4187 DeoptimizeIf(ne, env);
4188 __ bind(&success);
4189 }
4190
4191
4158 void LCodeGen::DoCheckMap(LCheckMap* instr) { 4192 void LCodeGen::DoCheckMap(LCheckMap* instr) {
4159 Register scratch = scratch0(); 4193 Register scratch = scratch0();
4160 LOperand* input = instr->InputAt(0); 4194 LOperand* input = instr->InputAt(0);
4161 ASSERT(input->IsRegister()); 4195 ASSERT(input->IsRegister());
4162 Register reg = ToRegister(input); 4196 Register reg = ToRegister(input);
4163 __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); 4197 Handle<Map> map = Handle<Map>(instr->hydrogen()->map());
4164 __ cmp(scratch, Operand(instr->hydrogen()->map())); 4198 DoCheckMapCommon(reg, scratch, map, instr->hydrogen()->mode(),
4165 DeoptimizeIf(ne, instr->environment()); 4199 instr->environment());
4166 } 4200 }
4167 4201
4168 4202
4169 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { 4203 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) {
4170 DoubleRegister value_reg = ToDoubleRegister(instr->unclamped()); 4204 DoubleRegister value_reg = ToDoubleRegister(instr->unclamped());
4171 Register result_reg = ToRegister(instr->result()); 4205 Register result_reg = ToRegister(instr->result());
4172 DoubleRegister temp_reg = ToDoubleRegister(instr->TempAt(0)); 4206 DoubleRegister temp_reg = ToDoubleRegister(instr->TempAt(0));
4173 __ ClampDoubleToUint8(result_reg, value_reg, temp_reg); 4207 __ ClampDoubleToUint8(result_reg, value_reg, temp_reg);
4174 } 4208 }
4175 4209
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
4224 Register temp2 = ToRegister(instr->TempAt(1)); 4258 Register temp2 = ToRegister(instr->TempAt(1));
4225 4259
4226 Handle<JSObject> holder = instr->holder(); 4260 Handle<JSObject> holder = instr->holder();
4227 Handle<JSObject> current_prototype = instr->prototype(); 4261 Handle<JSObject> current_prototype = instr->prototype();
4228 4262
4229 // Load prototype object. 4263 // Load prototype object.
4230 __ LoadHeapObject(temp1, current_prototype); 4264 __ LoadHeapObject(temp1, current_prototype);
4231 4265
4232 // Check prototype maps up to the holder. 4266 // Check prototype maps up to the holder.
4233 while (!current_prototype.is_identical_to(holder)) { 4267 while (!current_prototype.is_identical_to(holder)) {
4234 __ ldr(temp2, FieldMemOperand(temp1, HeapObject::kMapOffset)); 4268 DoCheckMapCommon(temp1, temp2,
4235 __ cmp(temp2, Operand(Handle<Map>(current_prototype->map()))); 4269 Handle<Map>(current_prototype->map()),
4236 DeoptimizeIf(ne, instr->environment()); 4270 ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment());
4237 current_prototype = 4271 current_prototype =
4238 Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype())); 4272 Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype()));
4239 // Load next prototype object. 4273 // Load next prototype object.
4240 __ LoadHeapObject(temp1, current_prototype); 4274 __ LoadHeapObject(temp1, current_prototype);
4241 } 4275 }
4242 4276
4243 // Check the holder map. 4277 // Check the holder map.
4244 __ ldr(temp2, FieldMemOperand(temp1, HeapObject::kMapOffset)); 4278 DoCheckMapCommon(temp1, temp2,
4245 __ cmp(temp2, Operand(Handle<Map>(current_prototype->map()))); 4279 Handle<Map>(current_prototype->map()),
4280 ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment());
4246 DeoptimizeIf(ne, instr->environment()); 4281 DeoptimizeIf(ne, instr->environment());
4247 } 4282 }
4248 4283
4249 4284
4250 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { 4285 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) {
4251 Heap* heap = isolate()->heap(); 4286 Heap* heap = isolate()->heap();
4252 ElementsKind boilerplate_elements_kind = 4287 ElementsKind boilerplate_elements_kind =
4253 instr->hydrogen()->boilerplate_elements_kind(); 4288 instr->hydrogen()->boilerplate_elements_kind();
4254 4289
4255 // Deopt if the array literal boilerplate ElementsKind is of a type different 4290 // Deopt if the array literal boilerplate ElementsKind is of a type different
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
4732 ASSERT(osr_pc_offset_ == -1); 4767 ASSERT(osr_pc_offset_ == -1);
4733 osr_pc_offset_ = masm()->pc_offset(); 4768 osr_pc_offset_ = masm()->pc_offset();
4734 } 4769 }
4735 4770
4736 4771
4737 4772
4738 4773
4739 #undef __ 4774 #undef __
4740 4775
4741 } } // namespace v8::internal 4776 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698