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

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

Issue 11346: Experimental: peridic merge from bleeding_edge. Merge... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: Created 12 years, 1 month 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 | « src/codegen-ia32.h ('k') | src/compiler.h » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 ZoneList<Statement*>* body = fun->body(); 102 ZoneList<Statement*>* body = fun->body();
103 103
104 // Initialize state. 104 // Initialize state.
105 ASSERT(scope_ == NULL); 105 ASSERT(scope_ == NULL);
106 scope_ = fun->scope(); 106 scope_ = fun->scope();
107 ASSERT(frame_ == NULL); 107 ASSERT(frame_ == NULL);
108 set_frame(new VirtualFrame(this)); 108 set_frame(new VirtualFrame(this));
109 cc_reg_ = no_condition; 109 cc_reg_ = no_condition;
110 function_return_.set_code_generator(this); 110 function_return_.set_code_generator(this);
111 function_return_is_shadowed_ = false; 111 function_return_is_shadowed_ = false;
112
113 // Adjust for function-level loop nesting.
114 loop_nesting_ += fun->loop_nesting();
115
112 { 116 {
113 CodeGenState state(this); 117 CodeGenState state(this);
114 118
115 // Entry 119 // Entry
116 // stack: function, receiver, arguments, return address 120 // stack: function, receiver, arguments, return address
117 // esp: stack pointer 121 // esp: stack pointer
118 // ebp: frame pointer 122 // ebp: frame pointer
119 // edi: caller's parameter pointer 123 // edi: caller's parameter pointer
120 // esi: callee's context 124 // esi: callee's context
121 125
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // through. 291 // through.
288 if (frame_ != NULL) { 292 if (frame_ != NULL) {
289 Literal undefined(Factory::undefined_value()); 293 Literal undefined(Factory::undefined_value());
290 ReturnStatement statement(&undefined); 294 ReturnStatement statement(&undefined);
291 statement.set_statement_pos(fun->end_position()); 295 statement.set_statement_pos(fun->end_position());
292 VisitReturnStatement(&statement); 296 VisitReturnStatement(&statement);
293 } 297 }
294 } 298 }
295 } 299 }
296 300
301 // Adjust for function-level loop nesting.
302 loop_nesting_ -= fun->loop_nesting();
303
297 // Code generation state must be reset. 304 // Code generation state must be reset.
298 ASSERT(!function_return_is_shadowed_); 305 ASSERT(!function_return_is_shadowed_);
299 function_return_.Unuse(); 306 function_return_.Unuse();
300 scope_ = NULL; 307 scope_ = NULL;
301 delete_frame(); 308 delete_frame();
302 ASSERT(!has_cc()); 309 ASSERT(!has_cc());
303 ASSERT(state_ == NULL); 310 ASSERT(state_ == NULL);
311 ASSERT(loop_nesting() == 0);
304 } 312 }
305 313
306 314
307 Operand CodeGenerator::SlotOperand(Slot* slot, Register tmp) { 315 Operand CodeGenerator::SlotOperand(Slot* slot, Register tmp) {
308 // Currently, this assertion will fail if we try to assign to 316 // Currently, this assertion will fail if we try to assign to
309 // a constant variable that is constant because it is read-only 317 // a constant variable that is constant because it is read-only
310 // (such as the variable referring to a named function expression). 318 // (such as the variable referring to a named function expression).
311 // We need to implement assignments to read-only variables. 319 // We need to implement assignments to read-only variables.
312 // Ideally, we should do this during AST generation (by converting 320 // Ideally, we should do this during AST generation (by converting
313 // such assignments into expression statements); however, in general 321 // such assignments into expression statements); however, in general
(...skipping 2532 matching lines...) Expand 10 before | Expand all | Expand 10 after
2846 // JavaScript example: 'foo(1, 2, 3)' // foo is global 2854 // JavaScript example: 'foo(1, 2, 3)' // foo is global
2847 // ---------------------------------- 2855 // ----------------------------------
2848 2856
2849 // Push the name of the function and the receiver onto the stack. 2857 // Push the name of the function and the receiver onto the stack.
2850 frame_->EmitPush(Immediate(var->name())); 2858 frame_->EmitPush(Immediate(var->name()));
2851 2859
2852 // Pass the global object as the receiver and let the IC stub 2860 // Pass the global object as the receiver and let the IC stub
2853 // patch the stack to use the global proxy as 'this' in the 2861 // patch the stack to use the global proxy as 'this' in the
2854 // invoked function. 2862 // invoked function.
2855 LoadGlobal(); 2863 LoadGlobal();
2856
2857 // Load the arguments. 2864 // Load the arguments.
2858 int arg_count = args->length(); 2865 int arg_count = args->length();
2859 for (int i = 0; i < arg_count; i++) { 2866 for (int i = 0; i < arg_count; i++) {
2860 Load(args->at(i)); 2867 Load(args->at(i));
2861 } 2868 }
2862 2869
2863 // Setup the receiver register and call the IC initialization code. 2870 // Setup the receiver register and call the IC initialization code.
2864 Handle<Code> stub = ComputeCallInitialize(arg_count); 2871 Handle<Code> stub = (loop_nesting() > 0)
2872 ? ComputeCallInitializeInLoop(arg_count)
2873 : ComputeCallInitialize(arg_count);
2865 __ RecordPosition(node->position()); 2874 __ RecordPosition(node->position());
2866 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET_CONTEXT, 2875 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET_CONTEXT,
2867 arg_count + 1); 2876 arg_count + 1);
2868 __ mov(esi, frame_->Context()); 2877 __ mov(esi, frame_->Context());
2869 2878
2870 // Overwrite the function on the stack with the result. 2879 // Overwrite the function on the stack with the result.
2871 __ mov(frame_->Top(), eax); 2880 __ mov(frame_->Top(), eax);
2872 2881
2873 } else if (var != NULL && var->slot() != NULL && 2882 } else if (var != NULL && var->slot() != NULL &&
2874 var->slot()->type() == Slot::LOOKUP) { 2883 var->slot()->type() == Slot::LOOKUP) {
(...skipping 27 matching lines...) Expand all
2902 frame_->EmitPush(Immediate(literal->handle())); 2911 frame_->EmitPush(Immediate(literal->handle()));
2903 Load(property->obj()); 2912 Load(property->obj());
2904 2913
2905 // Load the arguments. 2914 // Load the arguments.
2906 int arg_count = args->length(); 2915 int arg_count = args->length();
2907 for (int i = 0; i < arg_count; i++) { 2916 for (int i = 0; i < arg_count; i++) {
2908 Load(args->at(i)); 2917 Load(args->at(i));
2909 } 2918 }
2910 2919
2911 // Call the IC initialization code. 2920 // Call the IC initialization code.
2912 Handle<Code> stub = ComputeCallInitialize(arg_count); 2921 Handle<Code> stub = (loop_nesting() > 0)
2922 ? ComputeCallInitializeInLoop(arg_count)
2923 : ComputeCallInitialize(arg_count);
2913 __ RecordPosition(node->position()); 2924 __ RecordPosition(node->position());
2914 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1); 2925 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1);
2915 __ mov(esi, frame_->Context()); 2926 __ mov(esi, frame_->Context());
2916 2927
2917 // Overwrite the function on the stack with the result. 2928 // Overwrite the function on the stack with the result.
2918 __ mov(frame_->Top(), eax); 2929 __ mov(frame_->Top(), eax);
2919 2930
2920 } else { 2931 } else {
2921 // ------------------------------------------- 2932 // -------------------------------------------
2922 // JavaScript example: 'array[index](1, 2, 3)' 2933 // JavaScript example: 'array[index](1, 2, 3)'
(...skipping 2433 matching lines...) Expand 10 before | Expand all | Expand 10 after
5356 5367
5357 // Slow-case: Go through the JavaScript implementation. 5368 // Slow-case: Go through the JavaScript implementation.
5358 __ bind(&slow); 5369 __ bind(&slow);
5359 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); 5370 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION);
5360 } 5371 }
5361 5372
5362 5373
5363 #undef __ 5374 #undef __
5364 5375
5365 } } // namespace v8::internal 5376 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/codegen-ia32.h ('k') | src/compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698