Improve load of global variables.

Review URL: http://codereview.chromium.org/651019

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3911 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
whesse@chromium.org 2010-02-19 10:05:33 +00:00
parent ec86513519
commit d2dd02152c

View File

@ -689,6 +689,9 @@ void CodeGenerator::LoadReference(Reference* ref) {
// The expression is a variable proxy that does not rewrite to a // The expression is a variable proxy that does not rewrite to a
// property. Global variables are treated as named property references. // property. Global variables are treated as named property references.
if (var->is_global()) { if (var->is_global()) {
// Named loads require object in eax. Named stores don't use references.
// Spilling eax makes it free, so LoadGlobal loads directly into eax.
frame_->Spill(eax);
LoadGlobal(); LoadGlobal();
ref->set_type(Reference::NAMED); ref->set_type(Reference::NAMED);
} else { } else {