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

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

Issue 10834085: Fix full code generator to not use --debug-code if it is in (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 4 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 2012 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
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 Split(equal, if_true, if_false, NULL); 747 Split(equal, if_true, if_false, NULL);
748 __ bind(&skip); 748 __ bind(&skip);
749 } 749 }
750 } 750 }
751 751
752 752
753 void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) { 753 void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) {
754 // The variable in the declaration always resides in the current function 754 // The variable in the declaration always resides in the current function
755 // context. 755 // context.
756 ASSERT_EQ(0, scope()->ContextChainLength(variable->scope())); 756 ASSERT_EQ(0, scope()->ContextChainLength(variable->scope()));
757 if (FLAG_debug_code) { 757 if (generate_debug_code_) {
758 // Check that we're not inside a with or catch context. 758 // Check that we're not inside a with or catch context.
759 __ mov(ebx, FieldOperand(esi, HeapObject::kMapOffset)); 759 __ mov(ebx, FieldOperand(esi, HeapObject::kMapOffset));
760 __ cmp(ebx, isolate()->factory()->with_context_map()); 760 __ cmp(ebx, isolate()->factory()->with_context_map());
761 __ Check(not_equal, "Declaration in with context."); 761 __ Check(not_equal, "Declaration in with context.");
762 __ cmp(ebx, isolate()->factory()->catch_context_map()); 762 __ cmp(ebx, isolate()->factory()->catch_context_map());
763 __ Check(not_equal, "Declaration in catch context."); 763 __ Check(not_equal, "Declaration in catch context.");
764 } 764 }
765 } 765 }
766 766
767 767
(...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after
2084 int offset = Context::SlotOffset(var->index()); 2084 int offset = Context::SlotOffset(var->index());
2085 __ RecordWriteContextSlot(ecx, offset, edx, ebx, kDontSaveFPRegs); 2085 __ RecordWriteContextSlot(ecx, offset, edx, ebx, kDontSaveFPRegs);
2086 } 2086 }
2087 } 2087 }
2088 2088
2089 } else if (!var->is_const_mode() || op == Token::INIT_CONST_HARMONY) { 2089 } else if (!var->is_const_mode() || op == Token::INIT_CONST_HARMONY) {
2090 // Assignment to var or initializing assignment to let/const 2090 // Assignment to var or initializing assignment to let/const
2091 // in harmony mode. 2091 // in harmony mode.
2092 if (var->IsStackAllocated() || var->IsContextSlot()) { 2092 if (var->IsStackAllocated() || var->IsContextSlot()) {
2093 MemOperand location = VarOperand(var, ecx); 2093 MemOperand location = VarOperand(var, ecx);
2094 if (FLAG_debug_code && op == Token::INIT_LET) { 2094 if (generate_debug_code_ && op == Token::INIT_LET) {
2095 // Check for an uninitialized let binding. 2095 // Check for an uninitialized let binding.
2096 __ mov(edx, location); 2096 __ mov(edx, location);
2097 __ cmp(edx, isolate()->factory()->the_hole_value()); 2097 __ cmp(edx, isolate()->factory()->the_hole_value());
2098 __ Check(equal, "Let binding re-initialization."); 2098 __ Check(equal, "Let binding re-initialization.");
2099 } 2099 }
2100 // Perform the assignment. 2100 // Perform the assignment.
2101 __ mov(location, eax); 2101 __ mov(location, eax);
2102 if (var->IsContextSlot()) { 2102 if (var->IsContextSlot()) {
2103 __ mov(edx, eax); 2103 __ mov(edx, eax);
2104 int offset = Context::SlotOffset(var->index()); 2104 int offset = Context::SlotOffset(var->index());
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
2633 2633
2634 VisitForAccumulatorValue(args->at(0)); 2634 VisitForAccumulatorValue(args->at(0));
2635 2635
2636 Label materialize_true, materialize_false; 2636 Label materialize_true, materialize_false;
2637 Label* if_true = NULL; 2637 Label* if_true = NULL;
2638 Label* if_false = NULL; 2638 Label* if_false = NULL;
2639 Label* fall_through = NULL; 2639 Label* fall_through = NULL;
2640 context()->PrepareTest(&materialize_true, &materialize_false, 2640 context()->PrepareTest(&materialize_true, &materialize_false,
2641 &if_true, &if_false, &fall_through); 2641 &if_true, &if_false, &fall_through);
2642 2642
2643 if (FLAG_debug_code) __ AbortIfSmi(eax); 2643 if (generate_debug_code_) __ AbortIfSmi(eax);
2644 2644
2645 // Check whether this map has already been checked to be safe for default 2645 // Check whether this map has already been checked to be safe for default
2646 // valueOf. 2646 // valueOf.
2647 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); 2647 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset));
2648 __ test_b(FieldOperand(ebx, Map::kBitField2Offset), 2648 __ test_b(FieldOperand(ebx, Map::kBitField2Offset),
2649 1 << Map::kStringWrapperSafeForDefaultValueOf); 2649 1 << Map::kStringWrapperSafeForDefaultValueOf);
2650 __ j(not_zero, if_true); 2650 __ j(not_zero, if_true);
2651 2651
2652 // Check for fast case object. Return false for slow case objects. 2652 // Check for fast case object. Return false for slow case objects.
2653 __ mov(ecx, FieldOperand(eax, JSObject::kPropertiesOffset)); 2653 __ mov(ecx, FieldOperand(eax, JSObject::kPropertiesOffset));
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
2858 __ mov(ebx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); 2858 __ mov(ebx, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
2859 __ cmp(Operand(ebx, StandardFrameConstants::kContextOffset), 2859 __ cmp(Operand(ebx, StandardFrameConstants::kContextOffset),
2860 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 2860 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
2861 __ j(not_equal, &exit); 2861 __ j(not_equal, &exit);
2862 2862
2863 // Arguments adaptor case: Read the arguments length from the 2863 // Arguments adaptor case: Read the arguments length from the
2864 // adaptor frame. 2864 // adaptor frame.
2865 __ mov(eax, Operand(ebx, ArgumentsAdaptorFrameConstants::kLengthOffset)); 2865 __ mov(eax, Operand(ebx, ArgumentsAdaptorFrameConstants::kLengthOffset));
2866 2866
2867 __ bind(&exit); 2867 __ bind(&exit);
2868 if (FLAG_debug_code) __ AbortIfNotSmi(eax); 2868 if (generate_debug_code_) __ AbortIfNotSmi(eax);
2869 context()->Plug(eax); 2869 context()->Plug(eax);
2870 } 2870 }
2871 2871
2872 2872
2873 void FullCodeGenerator::EmitClassOf(CallRuntime* expr) { 2873 void FullCodeGenerator::EmitClassOf(CallRuntime* expr) {
2874 ZoneList<Expression*>* args = expr->arguments(); 2874 ZoneList<Expression*>* args = expr->arguments();
2875 ASSERT(args->length() == 1); 2875 ASSERT(args->length() == 1);
2876 Label done, null, function, non_function_constructor; 2876 Label done, null, function, non_function_constructor;
2877 2877
2878 VisitForAccumulatorValue(args->at(0)); 2878 VisitForAccumulatorValue(args->at(0));
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
3478 context()->Plug(eax); 3478 context()->Plug(eax);
3479 } 3479 }
3480 3480
3481 3481
3482 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { 3482 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) {
3483 ZoneList<Expression*>* args = expr->arguments(); 3483 ZoneList<Expression*>* args = expr->arguments();
3484 ASSERT(args->length() == 1); 3484 ASSERT(args->length() == 1);
3485 3485
3486 VisitForAccumulatorValue(args->at(0)); 3486 VisitForAccumulatorValue(args->at(0));
3487 3487
3488 if (FLAG_debug_code) { 3488 if (generate_debug_code_) {
3489 __ AbortIfNotString(eax); 3489 __ AbortIfNotString(eax);
3490 } 3490 }
3491 3491
3492 Label materialize_true, materialize_false; 3492 Label materialize_true, materialize_false;
3493 Label* if_true = NULL; 3493 Label* if_true = NULL;
3494 Label* if_false = NULL; 3494 Label* if_false = NULL;
3495 Label* fall_through = NULL; 3495 Label* fall_through = NULL;
3496 context()->PrepareTest(&materialize_true, &materialize_false, 3496 context()->PrepareTest(&materialize_true, &materialize_false,
3497 &if_true, &if_false, &fall_through); 3497 &if_true, &if_false, &fall_through);
3498 3498
3499 __ test(FieldOperand(eax, String::kHashFieldOffset), 3499 __ test(FieldOperand(eax, String::kHashFieldOffset),
3500 Immediate(String::kContainsCachedArrayIndexMask)); 3500 Immediate(String::kContainsCachedArrayIndexMask));
3501 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); 3501 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
3502 Split(zero, if_true, if_false, fall_through); 3502 Split(zero, if_true, if_false, fall_through);
3503 3503
3504 context()->Plug(if_true, if_false); 3504 context()->Plug(if_true, if_false);
3505 } 3505 }
3506 3506
3507 3507
3508 void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) { 3508 void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) {
3509 ZoneList<Expression*>* args = expr->arguments(); 3509 ZoneList<Expression*>* args = expr->arguments();
3510 ASSERT(args->length() == 1); 3510 ASSERT(args->length() == 1);
3511 VisitForAccumulatorValue(args->at(0)); 3511 VisitForAccumulatorValue(args->at(0));
3512 3512
3513 if (FLAG_debug_code) { 3513 if (generate_debug_code_) {
3514 __ AbortIfNotString(eax); 3514 __ AbortIfNotString(eax);
3515 } 3515 }
3516 3516
3517 __ mov(eax, FieldOperand(eax, String::kHashFieldOffset)); 3517 __ mov(eax, FieldOperand(eax, String::kHashFieldOffset));
3518 __ IndexFromHash(eax, eax); 3518 __ IndexFromHash(eax, eax);
3519 3519
3520 context()->Plug(eax); 3520 context()->Plug(eax);
3521 } 3521 }
3522 3522
3523 3523
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
3579 array = no_reg; 3579 array = no_reg;
3580 3580
3581 3581
3582 // Check that all array elements are sequential ASCII strings, and 3582 // Check that all array elements are sequential ASCII strings, and
3583 // accumulate the sum of their lengths, as a smi-encoded value. 3583 // accumulate the sum of their lengths, as a smi-encoded value.
3584 __ Set(index, Immediate(0)); 3584 __ Set(index, Immediate(0));
3585 __ Set(string_length, Immediate(0)); 3585 __ Set(string_length, Immediate(0));
3586 // Loop condition: while (index < length). 3586 // Loop condition: while (index < length).
3587 // Live loop registers: index, array_length, string, 3587 // Live loop registers: index, array_length, string,
3588 // scratch, string_length, elements. 3588 // scratch, string_length, elements.
3589 if (FLAG_debug_code) { 3589 if (generate_debug_code_) {
3590 __ cmp(index, array_length); 3590 __ cmp(index, array_length);
3591 __ Assert(less, "No empty arrays here in EmitFastAsciiArrayJoin"); 3591 __ Assert(less, "No empty arrays here in EmitFastAsciiArrayJoin");
3592 } 3592 }
3593 __ bind(&loop); 3593 __ bind(&loop);
3594 __ mov(string, FieldOperand(elements, 3594 __ mov(string, FieldOperand(elements,
3595 index, 3595 index,
3596 times_pointer_size, 3596 times_pointer_size,
3597 FixedArray::kHeaderSize)); 3597 FixedArray::kHeaderSize));
3598 __ JumpIfSmi(string, &bailout); 3598 __ JumpIfSmi(string, &bailout);
3599 __ mov(scratch, FieldOperand(string, HeapObject::kMapOffset)); 3599 __ mov(scratch, FieldOperand(string, HeapObject::kMapOffset));
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
4541 *stack_depth = 0; 4541 *stack_depth = 0;
4542 *context_length = 0; 4542 *context_length = 0;
4543 return previous_; 4543 return previous_;
4544 } 4544 }
4545 4545
4546 #undef __ 4546 #undef __
4547 4547
4548 } } // namespace v8::internal 4548 } } // namespace v8::internal
4549 4549
4550 #endif // V8_TARGET_ARCH_IA32 4550 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698