diff options
Diffstat (limited to 'chromium/v8/src/codegen.h')
-rw-r--r-- | chromium/v8/src/codegen.h | 110 |
1 files changed, 77 insertions, 33 deletions
diff --git a/chromium/v8/src/codegen.h b/chromium/v8/src/codegen.h index 33672a2b341..ec36b150d80 100644 --- a/chromium/v8/src/codegen.h +++ b/chromium/v8/src/codegen.h @@ -1,36 +1,12 @@ // Copyright 2012 the V8 project authors. All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #ifndef V8_CODEGEN_H_ #define V8_CODEGEN_H_ -#include "code-stubs.h" -#include "runtime.h" -#include "type-info.h" +#include "src/code-stubs.h" +#include "src/runtime.h" // Include the declaration of the architecture defined class CodeGenerator. // The contract to the shared code is that the the CodeGenerator is a subclass @@ -70,13 +46,17 @@ enum TypeofState { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF }; #if V8_TARGET_ARCH_IA32 -#include "ia32/codegen-ia32.h" +#include "src/ia32/codegen-ia32.h" #elif V8_TARGET_ARCH_X64 -#include "x64/codegen-x64.h" +#include "src/x64/codegen-x64.h" +#elif V8_TARGET_ARCH_ARM64 +#include "src/arm64/codegen-arm64.h" #elif V8_TARGET_ARCH_ARM -#include "arm/codegen-arm.h" +#include "src/arm/codegen-arm.h" #elif V8_TARGET_ARCH_MIPS -#include "mips/codegen-mips.h" +#include "src/mips/codegen-mips.h" +#elif V8_TARGET_ARCH_X87 +#include "src/x87/codegen-x87.h" #else #error Unsupported target architecture. #endif @@ -84,16 +64,53 @@ enum TypeofState { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF }; namespace v8 { namespace internal { + +class CompilationInfo; + + +class CodeGenerator { + public: + // Printing of AST, etc. as requested by flags. + static void MakeCodePrologue(CompilationInfo* info, const char* kind); + + // Allocate and install the code. + static Handle<Code> MakeCodeEpilogue(MacroAssembler* masm, + Code::Flags flags, + CompilationInfo* info); + + // Print the code after compiling it. + static void PrintCode(Handle<Code> code, CompilationInfo* info); + + static bool RecordPositions(MacroAssembler* masm, + int pos, + bool right_here = false); + + private: + DISALLOW_COPY_AND_ASSIGN(CodeGenerator); +}; + + // Results of the library implementation of transcendental functions may differ // from the one we use in our generated code. Therefore we use the same // generated code both in runtime and compiled code. typedef double (*UnaryMathFunction)(double x); -UnaryMathFunction CreateTranscendentalFunction(TranscendentalCache::Type type); UnaryMathFunction CreateExpFunction(); UnaryMathFunction CreateSqrtFunction(); +double modulo(double x, double y); + +// Custom implementation of math functions. +double fast_exp(double input); +double fast_sqrt(double input); +#ifdef _WIN64 +void init_modulo_function(); +#endif +void lazily_initialize_fast_exp(); +void init_fast_sqrt_function(); + + class ElementsTransitionGenerator : public AllStatic { public: // If |mode| is set to DONT_TRACK_ALLOCATION_SITE, @@ -115,6 +132,33 @@ class ElementsTransitionGenerator : public AllStatic { static const int kNumberDictionaryProbes = 4; +class CodeAgingHelper { + public: + CodeAgingHelper(); + + uint32_t young_sequence_length() const { return young_sequence_.length(); } + bool IsYoung(byte* candidate) const { + return memcmp(candidate, + young_sequence_.start(), + young_sequence_.length()) == 0; + } + void CopyYoungSequenceTo(byte* new_buffer) const { + CopyBytes(new_buffer, young_sequence_.start(), young_sequence_.length()); + } + +#ifdef DEBUG + bool IsOld(byte* candidate) const; +#endif + + protected: + const EmbeddedVector<byte, kNoCodeAgeSequenceLength> young_sequence_; +#ifdef DEBUG +#ifdef V8_TARGET_ARCH_ARM64 + const EmbeddedVector<byte, kNoCodeAgeSequenceLength> old_sequence_; +#endif +#endif +}; + } } // namespace v8::internal #endif // V8_CODEGEN_H_ |