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

Side by Side Diff: src/accessors.cc

Issue 147075: Allocate arguments object on-demand instead of at function entry.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 6 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/ast.h » ('j') | src/ia32/codegen-ia32.cc » ('J')
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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 504
505 // Find the top invocation of the function by traversing frames. 505 // Find the top invocation of the function by traversing frames.
506 for (JavaScriptFrameIterator it; !it.done(); it.Advance()) { 506 for (JavaScriptFrameIterator it; !it.done(); it.Advance()) {
507 // Skip all frames that aren't invocations of the given function. 507 // Skip all frames that aren't invocations of the given function.
508 JavaScriptFrame* frame = it.frame(); 508 JavaScriptFrame* frame = it.frame();
509 if (frame->function() != *function) continue; 509 if (frame->function() != *function) continue;
510 510
511 // If there is an arguments variable in the stack, we return that. 511 // If there is an arguments variable in the stack, we return that.
512 int index = ScopeInfo<>::StackSlotIndex(frame->code(), 512 int index = ScopeInfo<>::StackSlotIndex(frame->code(),
513 Heap::arguments_symbol()); 513 Heap::arguments_symbol());
514 if (index >= 0) return frame->GetExpression(index); 514 if (index >= 0) {
515 Handle<Object> arguments = Handle<Object>(frame->GetExpression(index));
516 if (!arguments->IsTheHole()) return *arguments;
517 }
515 518
516 // If there isn't an arguments variable in the stack, we need to 519 // If there isn't an arguments variable in the stack, we need to
517 // find the frame that holds the actual arguments passed to the 520 // find the frame that holds the actual arguments passed to the
518 // function on the stack. 521 // function on the stack.
519 it.AdvanceToArgumentsFrame(); 522 it.AdvanceToArgumentsFrame();
520 frame = it.frame(); 523 frame = it.frame();
521 524
522 // Get the number of arguments and construct an arguments object 525 // Get the number of arguments and construct an arguments object
523 // mirror for the right frame. 526 // mirror for the right frame.
524 const int length = frame->GetProvidedParametersCount(); 527 const int length = frame->GetProvidedParametersCount();
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 } 645 }
643 646
644 647
645 const AccessorDescriptor Accessors::ObjectPrototype = { 648 const AccessorDescriptor Accessors::ObjectPrototype = {
646 ObjectGetPrototype, 649 ObjectGetPrototype,
647 ObjectSetPrototype, 650 ObjectSetPrototype,
648 0 651 0
649 }; 652 };
650 653
651 } } // namespace v8::internal 654 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/ast.h » ('j') | src/ia32/codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698