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

Side by Side Diff: src/arm/stub-cache-arm.cc

Issue 8166017: Track elements_kind transitions in KeyedStoreICs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix nits Created 9 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/ia32/stub-cache-ia32.cc » ('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 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 3260 matching lines...) Expand 10 before | Expand all | Expand 10 after
3271 DO_SMI_CHECK); 3271 DO_SMI_CHECK);
3272 3272
3273 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); 3273 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss();
3274 __ Jump(ic, RelocInfo::CODE_TARGET); 3274 __ Jump(ic, RelocInfo::CODE_TARGET);
3275 3275
3276 // Return the generated code. 3276 // Return the generated code.
3277 return GetCode(NORMAL, NULL); 3277 return GetCode(NORMAL, NULL);
3278 } 3278 }
3279 3279
3280 3280
3281 MaybeObject* KeyedStoreStubCompiler::CompileStoreElementWithTransition(
3282 Map* transitioned_map,
3283 Map* untransitioned_map_1,
3284 Map* untransitioned_map_2) {
3285 // ----------- S t a t e -------------
3286 // -- r0 : value
3287 // -- r1 : key
3288 // -- r2 : receiver
3289 // -- lr : return address
3290 // -- r3 : scratch
3291 // -----------------------------------
3292
3293 // The order of map occurrences in the generated code below is important.
3294 // Both IC code and Crankshaft rely on |transitioned_map| being the first
3295 // map in the stub.
3296
3297 Code* notransition_stub;
3298 ElementsKind elements_kind = transitioned_map->elements_kind();
3299 bool is_js_array = transitioned_map->instance_type() == JS_ARRAY_TYPE;
3300 MaybeObject* maybe_stub =
3301 KeyedStoreElementStub(is_js_array, elements_kind).TryGetCode();
3302 if (!maybe_stub->To(&notransition_stub)) return maybe_stub;
3303
3304 Label just_store, miss;
3305 __ JumpIfSmi(r2, &miss);
3306 __ ldr(r3, FieldMemOperand(r2, HeapObject::kMapOffset));
3307 // r3: receiver->map().
3308 __ mov(ip, Operand(Handle<Map>(transitioned_map)));
3309 __ cmp(r3, ip);
3310 __ b(eq, &just_store);
3311 ASSERT_NE(untransitioned_map_1, NULL);
3312 __ mov(ip, Operand(Handle<Map>(untransitioned_map_1)));
3313 __ cmp(r3, ip);
3314 Code* generic_stub = (strict_mode_ == kStrictMode)
3315 ? isolate()->builtins()->builtin(Builtins::kKeyedStoreIC_Generic_Strict)
3316 : isolate()->builtins()->builtin(Builtins::kKeyedStoreIC_Generic);
3317 __ Jump(Handle<Code>(generic_stub), RelocInfo::CODE_TARGET, eq);
3318 if (untransitioned_map_2 != NULL) {
3319 __ mov(ip, Operand(Handle<Map>(untransitioned_map_2)));
3320 __ cmp(r3, ip);
3321 __ Jump(Handle<Code>(generic_stub), RelocInfo::CODE_TARGET, eq);
3322 }
3323
3324 __ bind(&miss);
3325 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss();
3326 __ Jump(ic, RelocInfo::CODE_TARGET);
3327
3328 __ bind(&just_store);
3329 __ Jump(Handle<Code>(notransition_stub), RelocInfo::CODE_TARGET);
3330
3331 // Return the generated code.
3332 return GetCode(NORMAL, NULL, MEGAMORPHIC);
3333 }
3334
3335
3281 MaybeObject* KeyedStoreStubCompiler::CompileStoreMegamorphic( 3336 MaybeObject* KeyedStoreStubCompiler::CompileStoreMegamorphic(
3282 MapList* receiver_maps, 3337 MapList* receiver_maps,
3283 CodeList* handler_ics) { 3338 CodeList* handler_ics) {
3284 // ----------- S t a t e ------------- 3339 // ----------- S t a t e -------------
3285 // -- r0 : value 3340 // -- r0 : value
3286 // -- r1 : key 3341 // -- r1 : key
3287 // -- r2 : receiver 3342 // -- r2 : receiver
3288 // -- lr : return address 3343 // -- lr : return address
3289 // -- r3 : scratch 3344 // -- r3 : scratch
3290 // ----------------------------------- 3345 // -----------------------------------
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
4310 bool is_js_array, 4365 bool is_js_array,
4311 ElementsKind elements_kind) { 4366 ElementsKind elements_kind) {
4312 // ----------- S t a t e ------------- 4367 // ----------- S t a t e -------------
4313 // -- r0 : value 4368 // -- r0 : value
4314 // -- r1 : key 4369 // -- r1 : key
4315 // -- r2 : receiver 4370 // -- r2 : receiver
4316 // -- lr : return address 4371 // -- lr : return address
4317 // -- r3 : scratch 4372 // -- r3 : scratch
4318 // -- r4 : scratch (elements) 4373 // -- r4 : scratch (elements)
4319 // ----------------------------------- 4374 // -----------------------------------
4320 Label miss_force_generic; 4375 Label miss_force_generic, transition_elements_kind;
4321 4376
4322 Register value_reg = r0; 4377 Register value_reg = r0;
4323 Register key_reg = r1; 4378 Register key_reg = r1;
4324 Register receiver_reg = r2; 4379 Register receiver_reg = r2;
4325 Register scratch = r3; 4380 Register scratch = r3;
4326 Register elements_reg = r4; 4381 Register elements_reg = r4;
4327 4382
4328 // This stub is meant to be tail-jumped to, the receiver must already 4383 // This stub is meant to be tail-jumped to, the receiver must already
4329 // have been verified by the caller to not be a smi. 4384 // have been verified by the caller to not be a smi.
4330 4385
(...skipping 13 matching lines...) Expand all
4344 if (is_js_array) { 4399 if (is_js_array) {
4345 __ ldr(scratch, FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); 4400 __ ldr(scratch, FieldMemOperand(receiver_reg, JSArray::kLengthOffset));
4346 } else { 4401 } else {
4347 __ ldr(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset)); 4402 __ ldr(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset));
4348 } 4403 }
4349 // Compare smis. 4404 // Compare smis.
4350 __ cmp(key_reg, scratch); 4405 __ cmp(key_reg, scratch);
4351 __ b(hs, &miss_force_generic); 4406 __ b(hs, &miss_force_generic);
4352 4407
4353 if (elements_kind == FAST_SMI_ONLY_ELEMENTS) { 4408 if (elements_kind == FAST_SMI_ONLY_ELEMENTS) {
4354 __ JumpIfNotSmi(value_reg, &miss_force_generic); 4409 __ JumpIfNotSmi(value_reg, &transition_elements_kind);
4355 __ add(scratch, 4410 __ add(scratch,
4356 elements_reg, 4411 elements_reg,
4357 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 4412 Operand(FixedArray::kHeaderSize - kHeapObjectTag));
4358 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2); 4413 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2);
4359 __ add(scratch, 4414 __ add(scratch,
4360 scratch, 4415 scratch,
4361 Operand(key_reg, LSL, kPointerSizeLog2 - kSmiTagSize)); 4416 Operand(key_reg, LSL, kPointerSizeLog2 - kSmiTagSize));
4362 __ str(value_reg, MemOperand(scratch)); 4417 __ str(value_reg, MemOperand(scratch));
4363 } else { 4418 } else {
4364 ASSERT(elements_kind == FAST_ELEMENTS); 4419 ASSERT(elements_kind == FAST_ELEMENTS);
(...skipping 13 matching lines...) Expand all
4378 kDontSaveFPRegs); 4433 kDontSaveFPRegs);
4379 } 4434 }
4380 // value_reg (r0) is preserved. 4435 // value_reg (r0) is preserved.
4381 // Done. 4436 // Done.
4382 __ Ret(); 4437 __ Ret();
4383 4438
4384 __ bind(&miss_force_generic); 4439 __ bind(&miss_force_generic);
4385 Handle<Code> ic = 4440 Handle<Code> ic =
4386 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); 4441 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric();
4387 __ Jump(ic, RelocInfo::CODE_TARGET); 4442 __ Jump(ic, RelocInfo::CODE_TARGET);
4443
4444 __ bind(&transition_elements_kind);
4445 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss();
4446 __ Jump(ic_miss, RelocInfo::CODE_TARGET);
4388 } 4447 }
4389 4448
4390 4449
4391 void KeyedStoreStubCompiler::GenerateStoreFastDoubleElement( 4450 void KeyedStoreStubCompiler::GenerateStoreFastDoubleElement(
4392 MacroAssembler* masm, 4451 MacroAssembler* masm,
4393 bool is_js_array) { 4452 bool is_js_array) {
4394 // ----------- S t a t e ------------- 4453 // ----------- S t a t e -------------
4395 // -- r0 : value 4454 // -- r0 : value
4396 // -- r1 : key 4455 // -- r1 : key
4397 // -- r2 : receiver 4456 // -- r2 : receiver
4398 // -- lr : return address 4457 // -- lr : return address
4399 // -- r3 : scratch 4458 // -- r3 : scratch
4400 // -- r4 : scratch 4459 // -- r4 : scratch
4401 // -- r5 : scratch 4460 // -- r5 : scratch
4402 // ----------------------------------- 4461 // -----------------------------------
4403 Label miss_force_generic; 4462 Label miss_force_generic, transition_elements_kind;
4404 4463
4405 Register value_reg = r0; 4464 Register value_reg = r0;
4406 Register key_reg = r1; 4465 Register key_reg = r1;
4407 Register receiver_reg = r2; 4466 Register receiver_reg = r2;
4408 Register elements_reg = r3; 4467 Register elements_reg = r3;
4409 Register scratch1 = r4; 4468 Register scratch1 = r4;
4410 Register scratch2 = r5; 4469 Register scratch2 = r5;
4411 Register scratch3 = r6; 4470 Register scratch3 = r6;
4412 Register scratch4 = r7; 4471 Register scratch4 = r7;
4413 4472
(...skipping 17 matching lines...) Expand all
4431 __ b(hs, &miss_force_generic); 4490 __ b(hs, &miss_force_generic);
4432 4491
4433 __ StoreNumberToDoubleElements(value_reg, 4492 __ StoreNumberToDoubleElements(value_reg,
4434 key_reg, 4493 key_reg,
4435 receiver_reg, 4494 receiver_reg,
4436 elements_reg, 4495 elements_reg,
4437 scratch1, 4496 scratch1,
4438 scratch2, 4497 scratch2,
4439 scratch3, 4498 scratch3,
4440 scratch4, 4499 scratch4,
4441 &miss_force_generic); 4500 &transition_elements_kind);
4442 __ Ret(); 4501 __ Ret();
4443 4502
4444 // Handle store cache miss, replacing the ic with the generic stub. 4503 // Handle store cache miss, replacing the ic with the generic stub.
4445 __ bind(&miss_force_generic); 4504 __ bind(&miss_force_generic);
4446 Handle<Code> ic = 4505 Handle<Code> ic =
4447 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); 4506 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric();
4448 __ Jump(ic, RelocInfo::CODE_TARGET); 4507 __ Jump(ic, RelocInfo::CODE_TARGET);
4508
4509 __ bind(&transition_elements_kind);
4510 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss();
4511 __ Jump(ic_miss, RelocInfo::CODE_TARGET);
4449 } 4512 }
4450 4513
4451 4514
4452 #undef __ 4515 #undef __
4453 4516
4454 } } // namespace v8::internal 4517 } } // namespace v8::internal
4455 4518
4456 #endif // V8_TARGET_ARCH_ARM 4519 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698