From 893637a05718ee561b7a87f9ec8ccfbd03b1fab3 Mon Sep 17 00:00:00 2001 From: "fschneider@chromium.org" Date: Fri, 26 Feb 2010 09:32:48 +0000 Subject: [PATCH] Inlining a few virtual frame functions. Introducing a virtual-frame-inl.h file containing some platform-independent virtual frame function which are small enough to be inlined. Removed unnecessary #include of virtual-frame.h from register-allocator-inl.h and added the necessary explicit includes in a number of files. Review URL: http://codereview.chromium.org/660104 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3962 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/codegen-arm.cc | 5 +- src/arm/codegen-arm.h | 2 +- src/arm/fast-codegen-arm.cc | 1 + src/arm/full-codegen-arm.cc | 1 + src/arm/jump-target-arm.cc | 1 + src/arm/virtual-frame-arm.cc | 1 + src/arm/virtual-frame-arm.h | 14 ++--- src/codegen-inl.h | 3 + src/codegen.cc | 1 + src/full-codegen.cc | 1 + src/ia32/codegen-ia32.cc | 4 +- src/ia32/codegen-ia32.h | 2 +- src/ia32/full-codegen-ia32.cc | 1 + src/ia32/jump-target-ia32.cc | 1 + src/ia32/register-allocator-ia32.cc | 1 + src/ia32/virtual-frame-ia32.cc | 1 + src/ia32/virtual-frame-ia32.h | 16 +++-- src/jump-target-inl.h | 7 ++- src/jump-target.cc | 3 +- src/register-allocator-inl.h | 1 - src/register-allocator.cc | 1 + src/virtual-frame-inl.h | 109 +++++++++++++++++++++++++++++++++ src/virtual-frame.cc | 68 +------------------- src/x64/codegen-x64.cc | 4 +- src/x64/codegen-x64.h | 2 +- src/x64/fast-codegen-x64.cc | 1 + src/x64/full-codegen-x64.cc | 1 + src/x64/jump-target-x64.cc | 1 + src/x64/register-allocator-x64.cc | 1 + src/x64/virtual-frame-x64.cc | 1 + src/x64/virtual-frame-x64.h | 14 ++--- tools/gyp/v8.gyp | 1 + tools/visual_studio/v8_base.vcproj | 4 ++ tools/visual_studio/v8_base_arm.vcproj | 4 ++ tools/visual_studio/v8_base_x64.vcproj | 4 ++ 35 files changed, 175 insertions(+), 108 deletions(-) create mode 100644 src/virtual-frame-inl.h diff --git a/src/arm/codegen-arm.cc b/src/arm/codegen-arm.cc index 311c94b..df1db69 100644 --- a/src/arm/codegen-arm.cc +++ b/src/arm/codegen-arm.cc @@ -35,7 +35,7 @@ #include "register-allocator-inl.h" #include "runtime.h" #include "scopes.h" - +#include "virtual-frame-inl.h" namespace v8 { namespace internal { @@ -133,9 +133,6 @@ CodeGenerator::CodeGenerator(MacroAssembler* masm) } -Scope* CodeGenerator::scope() { return info_->function()->scope(); } - - // Calling conventions: // fp: caller's frame pointer // sp: stack pointer diff --git a/src/arm/codegen-arm.h b/src/arm/codegen-arm.h index 22dd854..9bbf37b 100644 --- a/src/arm/codegen-arm.h +++ b/src/arm/codegen-arm.h @@ -203,7 +203,7 @@ class CodeGenerator: public AstVisitor { // Accessors inline bool is_eval(); - Scope* scope(); + inline Scope* scope(); // Generating deferred code. void ProcessDeferred(); diff --git a/src/arm/fast-codegen-arm.cc b/src/arm/fast-codegen-arm.cc index dad2af4..2654a16 100644 --- a/src/arm/fast-codegen-arm.cc +++ b/src/arm/fast-codegen-arm.cc @@ -29,6 +29,7 @@ #include "codegen-inl.h" #include "fast-codegen.h" +#include "scopes.h" namespace v8 { namespace internal { diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc index 3aa2a00..230818f 100644 --- a/src/arm/full-codegen-arm.cc +++ b/src/arm/full-codegen-arm.cc @@ -32,6 +32,7 @@ #include "debug.h" #include "full-codegen.h" #include "parser.h" +#include "scopes.h" namespace v8 { namespace internal { diff --git a/src/arm/jump-target-arm.cc b/src/arm/jump-target-arm.cc index 3315f83..a84060d 100644 --- a/src/arm/jump-target-arm.cc +++ b/src/arm/jump-target-arm.cc @@ -30,6 +30,7 @@ #include "codegen-inl.h" #include "jump-target-inl.h" #include "register-allocator-inl.h" +#include "virtual-frame-inl.h" namespace v8 { namespace internal { diff --git a/src/arm/virtual-frame-arm.cc b/src/arm/virtual-frame-arm.cc index 0f7c597..6e1a47f 100644 --- a/src/arm/virtual-frame-arm.cc +++ b/src/arm/virtual-frame-arm.cc @@ -30,6 +30,7 @@ #include "codegen-inl.h" #include "register-allocator-inl.h" #include "scopes.h" +#include "virtual-frame-inl.h" namespace v8 { namespace internal { diff --git a/src/arm/virtual-frame-arm.h b/src/arm/virtual-frame-arm.h index a45cfc6..f69bddf 100644 --- a/src/arm/virtual-frame-arm.h +++ b/src/arm/virtual-frame-arm.h @@ -62,7 +62,7 @@ class VirtualFrame : public ZoneObject { VirtualFrame(); // Construct a virtual frame as a clone of an existing one. - explicit VirtualFrame(VirtualFrame* original); + explicit inline VirtualFrame(VirtualFrame* original); CodeGenerator* cgen() { return CodeGeneratorScope::Current(); } MacroAssembler* masm() { return cgen()->masm(); } @@ -344,9 +344,9 @@ class VirtualFrame : public ZoneObject { void EmitPushMultiple(int count, int src_regs); // Push an element on the virtual frame. - void Push(Register reg, NumberInfo::Type info = NumberInfo::kUnknown); - void Push(Handle value); - void Push(Smi* value) { Push(Handle(value)); } + inline void Push(Register reg, NumberInfo::Type info = NumberInfo::kUnknown); + inline void Push(Handle value); + inline void Push(Smi* value); // Pushing a result invalidates it (its contents become owned by the frame). void Push(Result* result) { @@ -362,7 +362,7 @@ class VirtualFrame : public ZoneObject { // Nip removes zero or more elements from immediately below the top // of the frame, leaving the previous top-of-frame value on top of // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x). - void Nip(int num_dropped); + inline void Nip(int num_dropped); private: static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; @@ -457,7 +457,7 @@ class VirtualFrame : public ZoneObject { // Push a copy of a frame slot (typically a local or parameter) on top of // the frame. - void PushFrameSlotAt(int index); + inline void PushFrameSlotAt(int index); // Push a the value of a frame slot (typically a local or parameter) on // top of the frame and invalidate the slot. @@ -500,7 +500,7 @@ class VirtualFrame : public ZoneObject { // Register counts are correctly updated. int InvalidateFrameSlotAt(int index); - bool Equals(VirtualFrame* other); + inline bool Equals(VirtualFrame* other); // Classes that need raw access to the elements_ array. friend class DeferredCode; diff --git a/src/codegen-inl.h b/src/codegen-inl.h index da8cbf7..6534e7f 100644 --- a/src/codegen-inl.h +++ b/src/codegen-inl.h @@ -50,8 +50,11 @@ namespace v8 { namespace internal { Handle