| OLD | NEW | 
|     1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |     1 // Copyright 2006-2009 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   106   ASSERT(allocator_ == NULL); |   106   ASSERT(allocator_ == NULL); | 
|   107   RegisterAllocator register_allocator(this); |   107   RegisterAllocator register_allocator(this); | 
|   108   allocator_ = ®ister_allocator; |   108   allocator_ = ®ister_allocator; | 
|   109   ASSERT(frame_ == NULL); |   109   ASSERT(frame_ == NULL); | 
|   110   frame_ = new VirtualFrame(this); |   110   frame_ = new VirtualFrame(this); | 
|   111   set_in_spilled_code(false); |   111   set_in_spilled_code(false); | 
|   112  |   112  | 
|   113   // Adjust for function-level loop nesting. |   113   // Adjust for function-level loop nesting. | 
|   114   loop_nesting_ += fun->loop_nesting(); |   114   loop_nesting_ += fun->loop_nesting(); | 
|   115  |   115  | 
|   116   { |   116 #ifdef DEBUG | 
 |   117   if (strlen(FLAG_stop_at) > 0 && | 
 |   118       fun->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { | 
 |   119     frame_->SpillAll(); | 
 |   120     __ int3(); | 
 |   121   } | 
 |   122 #endif | 
 |   123  | 
 |   124   // New scope to get automatic timing calculation. | 
 |   125   {  // NOLINT | 
|   117     CodeGenState state(this); |   126     CodeGenState state(this); | 
|   118  |   127  | 
|   119     // Entry: |   128     // Entry: | 
|   120     // Stack: receiver, arguments, return address. |   129     // Stack: receiver, arguments, return address. | 
|   121     // ebp: caller's frame pointer |   130     // ebp: caller's frame pointer | 
|   122     // esp: stack pointer |   131     // esp: stack pointer | 
|   123     // edi: called JS function |   132     // edi: called JS function | 
|   124     // esi: callee's context |   133     // esi: callee's context | 
|   125     allocator_->Initialize(); |   134     allocator_->Initialize(); | 
|   126     frame_->Enter(); |   135     frame_->Enter(); | 
|   127  |   136  | 
|   128 #ifdef DEBUG |  | 
|   129     if (strlen(FLAG_stop_at) > 0 && |  | 
|   130         fun->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { |  | 
|   131       frame_->SpillAll(); |  | 
|   132       __ int3(); |  | 
|   133     } |  | 
|   134 #endif |  | 
|   135  |  | 
|   136     // Allocate space for locals and initialize them. |   137     // Allocate space for locals and initialize them. | 
|   137     frame_->AllocateStackSlots(scope_->num_stack_slots()); |   138     frame_->AllocateStackSlots(scope_->num_stack_slots()); | 
|   138     // Initialize the function return target after the locals are set |   139     // Initialize the function return target after the locals are set | 
|   139     // up, because it needs the expected frame height from the frame. |   140     // up, because it needs the expected frame height from the frame. | 
|   140     function_return_.Initialize(this, JumpTarget::BIDIRECTIONAL); |   141     function_return_.Initialize(this, JumpTarget::BIDIRECTIONAL); | 
|   141     function_return_is_shadowed_ = false; |   142     function_return_is_shadowed_ = false; | 
|   142  |   143  | 
|   143     // Allocate the arguments object and copy the parameters into it. |   144     // Allocate the arguments object and copy the parameters into it. | 
|   144     if (scope_->arguments() != NULL) { |   145     if (scope_->arguments() != NULL) { | 
|   145       ASSERT(scope_->arguments_shadow() != NULL); |   146       ASSERT(scope_->arguments_shadow() != NULL); | 
| (...skipping 4723 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4869     } |  4870     } | 
|  4870  |  4871  | 
|  4871     // If the count operation didn't overflow and the result is a |  4872     // If the count operation didn't overflow and the result is a | 
|  4872     // valid smi, we're done. Otherwise, we jump to the deferred |  4873     // valid smi, we're done. Otherwise, we jump to the deferred | 
|  4873     // slow-case code. |  4874     // slow-case code. | 
|  4874     // |  4875     // | 
|  4875     // We combine the overflow and the smi check if we could |  4876     // We combine the overflow and the smi check if we could | 
|  4876     // successfully allocate a temporary byte register. |  4877     // successfully allocate a temporary byte register. | 
|  4877     if (tmp.is_valid()) { |  4878     if (tmp.is_valid()) { | 
|  4878       __ setcc(overflow, tmp.reg()); |  4879       __ setcc(overflow, tmp.reg()); | 
|  4879       __ or_(Operand(value.reg()), tmp.reg()); |  4880       __ or_(Operand(tmp.reg()), value.reg()); | 
 |  4881       __ test(tmp.reg(), Immediate(kSmiTagMask)); | 
|  4880       tmp.Unuse(); |  4882       tmp.Unuse(); | 
|  4881       __ test(value.reg(), Immediate(kSmiTagMask)); |  | 
|  4882       deferred->enter()->Branch(not_zero, &value, not_taken); |  4883       deferred->enter()->Branch(not_zero, &value, not_taken); | 
|  4883     } else {  // Otherwise we test separately for overflow and smi check. |  4884     } else {  // Otherwise we test separately for overflow and smi check. | 
|  4884       deferred->enter()->Branch(overflow, &value, not_taken); |  4885       deferred->enter()->Branch(overflow, &value, not_taken); | 
|  4885       __ test(value.reg(), Immediate(kSmiTagMask)); |  4886       __ test(value.reg(), Immediate(kSmiTagMask)); | 
|  4886       deferred->enter()->Branch(not_zero, &value, not_taken); |  4887       deferred->enter()->Branch(not_zero, &value, not_taken); | 
|  4887     } |  4888     } | 
|  4888  |  4889  | 
|  4889     // Store the new value in the target if not const. |  4890     // Store the new value in the target if not const. | 
|  4890     deferred->BindExit(&value); |  4891     deferred->BindExit(&value); | 
|  4891     frame_->Push(&value); |  4892     frame_->Push(&value); | 
| (...skipping 2339 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  7231  |  7232  | 
|  7232   // Slow-case: Go through the JavaScript implementation. |  7233   // Slow-case: Go through the JavaScript implementation. | 
|  7233   __ bind(&slow); |  7234   __ bind(&slow); | 
|  7234   __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |  7235   __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 
|  7235 } |  7236 } | 
|  7236  |  7237  | 
|  7237  |  7238  | 
|  7238 #undef __ |  7239 #undef __ | 
|  7239  |  7240  | 
|  7240 } }  // namespace v8::internal |  7241 } }  // namespace v8::internal | 
| OLD | NEW |