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

Side by Side Diff: src/arm/full-codegen-arm.cc

Issue 6689006: Implement %_IsStringWrapperSafeForDefaultValue in full code generators. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 8 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/full-codegen-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 2525 matching lines...) Expand 10 before | Expand all | Expand 10 after
2536 2536
2537 VisitForAccumulatorValue(args->at(0)); 2537 VisitForAccumulatorValue(args->at(0));
2538 2538
2539 Label materialize_true, materialize_false; 2539 Label materialize_true, materialize_false;
2540 Label* if_true = NULL; 2540 Label* if_true = NULL;
2541 Label* if_false = NULL; 2541 Label* if_false = NULL;
2542 Label* fall_through = NULL; 2542 Label* fall_through = NULL;
2543 context()->PrepareTest(&materialize_true, &materialize_false, 2543 context()->PrepareTest(&materialize_true, &materialize_false,
2544 &if_true, &if_false, &fall_through); 2544 &if_true, &if_false, &fall_through);
2545 2545
2546 // Just indicate false, as %_IsStringWrapperSafeForDefaultValueOf() is only 2546 if (FLAG_debug_code) __ AbortIfSmi(r0);
2547 // used in a few functions in runtime.js which should not normally be hit by 2547
2548 // this compiler. 2548 __ ldr(r1, FieldMemOperand(r0, HeapObject::kMapOffset));
2549 __ ldrb(ip, FieldMemOperand(r1, Map::kBitField2Offset));
2550 __ tst(ip, Operand(1 << Map::kStringWrapperSafeForDefaultValueOf));
2551 __ b(ne, if_true);
2552
2553 // Check for fast case object. Generate false result for slow case object.
2554 __ ldr(r2, FieldMemOperand(r0, JSObject::kPropertiesOffset));
2555 __ ldr(r2, FieldMemOperand(r2, HeapObject::kMapOffset));
2556 __ LoadRoot(ip, Heap::kHashTableMapRootIndex);
2557 __ cmp(r2, ip);
2558 __ b(eq, if_false);
2559
2560 // Look for valueOf symbol in the descriptor array, and indicate false if
2561 // found. The type is not checked, so if it is a transition it is a false
2562 // negative.
2563 __ ldr(r4, FieldMemOperand(r1, Map::kInstanceDescriptorsOffset));
2564 __ ldr(r3, FieldMemOperand(r4, FixedArray::kLengthOffset));
2565 // r4: descriptor array
2566 // r3: length of descriptor array
2567 // Calculate the end of the descriptor array.
2568 STATIC_ASSERT(kSmiTag == 0);
2569 STATIC_ASSERT(kSmiTagSize == 1);
2570 STATIC_ASSERT(kPointerSize == 4);
2571 __ add(r2, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
2572 __ add(r2, r2, Operand(r3, LSL, kPointerSizeLog2 - kSmiTagSize));
2573
2574 // Calculate location of the first key name.
2575 __ add(r4,
2576 r4,
2577 Operand(FixedArray::kHeaderSize - kHeapObjectTag +
2578 DescriptorArray::kFirstIndex * kPointerSize));
2579 // Loop through all the keys in the descriptor array. If one of these is the
2580 // symbol valueOf the result is false.
2581 Label entry, loop;
2582 // The use of ip to store the valueOf symbol asumes that it is not otherwise
2583 // used in the loop below.
2584 __ mov(ip, Operand(FACTORY->value_of_symbol()));
2585 __ jmp(&entry);
2586 __ bind(&loop);
2587 __ ldr(r3, MemOperand(r4, 0));
2588 __ cmp(r3, ip);
2589 __ b(eq, if_false);
2590 __ add(r4, r4, Operand(kPointerSize));
2591 __ bind(&entry);
2592 __ cmp(r4, Operand(r2));
2593 __ b(ne, &loop);
2594
2595 // If a valueOf property is not found on the object check that it's
2596 // prototype is the un-modified String prototype. If not result is false.
2597 __ ldr(r2, FieldMemOperand(r1, Map::kPrototypeOffset));
2598 __ tst(r2, Operand(kSmiTagMask));
2599 __ b(eq, if_false);
2600 __ ldr(r2, FieldMemOperand(r2, HeapObject::kMapOffset));
2601 __ ldr(r3, ContextOperand(cp, Context::GLOBAL_INDEX));
2602 __ ldr(r3, FieldMemOperand(r3, GlobalObject::kGlobalContextOffset));
2603 __ ldr(r3, ContextOperand(r3, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX));
2604 __ cmp(r2, r3);
2605 __ b(ne, if_false);
2606
2607 // Set the bit in the map to indicate that it has been checked safe for
2608 // default valueOf and set true result.
2609 __ ldrb(r2, FieldMemOperand(r4, Map::kBitField2Offset));
2610 __ orr(r2, r2, Operand(1 << Map::kStringWrapperSafeForDefaultValueOf));
2611 __ strb(r2, FieldMemOperand(r4, Map::kBitField2Offset));
2612 __ jmp(if_true);
2613
2549 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); 2614 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
2550 __ jmp(if_false);
2551 context()->Plug(if_true, if_false); 2615 context()->Plug(if_true, if_false);
2552 } 2616 }
2553 2617
2554 2618
2555 void FullCodeGenerator::EmitIsFunction(ZoneList<Expression*>* args) { 2619 void FullCodeGenerator::EmitIsFunction(ZoneList<Expression*>* args) {
2556 ASSERT(args->length() == 1); 2620 ASSERT(args->length() == 1);
2557 2621
2558 VisitForAccumulatorValue(args->at(0)); 2622 VisitForAccumulatorValue(args->at(0));
2559 2623
2560 Label materialize_true, materialize_false; 2624 Label materialize_true, materialize_false;
(...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after
4308 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. 4372 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value.
4309 __ add(pc, r1, Operand(masm_->CodeObject())); 4373 __ add(pc, r1, Operand(masm_->CodeObject()));
4310 } 4374 }
4311 4375
4312 4376
4313 #undef __ 4377 #undef __
4314 4378
4315 } } // namespace v8::internal 4379 } } // namespace v8::internal
4316 4380
4317 #endif // V8_TARGET_ARCH_ARM 4381 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698