2011-02-25 13:22:38 +00:00
|
|
|
// Copyright 2011 the V8 project authors. All rights reserved.
|
2014-04-29 06:42:26 +00:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
2009-05-04 07:16:10 +00:00
|
|
|
|
2009-05-06 13:27:35 +00:00
|
|
|
#ifndef V8_X64_CODEGEN_X64_H_
|
|
|
|
#define V8_X64_CODEGEN_X64_H_
|
|
|
|
|
2015-11-26 16:22:34 +00:00
|
|
|
#include "src/ast/ast.h"
|
2014-08-22 11:43:39 +00:00
|
|
|
#include "src/macro-assembler.h"
|
2010-03-18 11:54:53 +00:00
|
|
|
|
2009-05-25 10:05:56 +00:00
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
2009-05-06 13:27:35 +00:00
|
|
|
|
|
|
|
|
2011-11-24 10:16:39 +00:00
|
|
|
class StringCharLoadGenerator : public AllStatic {
|
|
|
|
public:
|
|
|
|
// Generates the code for handling different string types and loading the
|
|
|
|
// indexed character into |result|. We expect |index| as untagged input and
|
|
|
|
// |result| as untagged output.
|
|
|
|
static void Generate(MacroAssembler* masm,
|
|
|
|
Register string,
|
|
|
|
Register index,
|
|
|
|
Register result,
|
|
|
|
Label* call_runtime);
|
|
|
|
|
|
|
|
private:
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(StringCharLoadGenerator);
|
|
|
|
};
|
|
|
|
|
2012-11-26 13:12:35 +00:00
|
|
|
|
2013-08-27 01:21:39 +00:00
|
|
|
enum StackArgumentsAccessorReceiverMode {
|
|
|
|
ARGUMENTS_CONTAIN_RECEIVER,
|
|
|
|
ARGUMENTS_DONT_CONTAIN_RECEIVER
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class StackArgumentsAccessor BASE_EMBEDDED {
|
|
|
|
public:
|
|
|
|
StackArgumentsAccessor(
|
|
|
|
Register base_reg,
|
|
|
|
int argument_count_immediate,
|
|
|
|
StackArgumentsAccessorReceiverMode receiver_mode =
|
|
|
|
ARGUMENTS_CONTAIN_RECEIVER,
|
|
|
|
int extra_displacement_to_last_argument = 0)
|
|
|
|
: base_reg_(base_reg),
|
|
|
|
argument_count_reg_(no_reg),
|
|
|
|
argument_count_immediate_(argument_count_immediate),
|
|
|
|
receiver_mode_(receiver_mode),
|
|
|
|
extra_displacement_to_last_argument_(
|
|
|
|
extra_displacement_to_last_argument) { }
|
|
|
|
|
|
|
|
StackArgumentsAccessor(
|
|
|
|
Register base_reg,
|
|
|
|
Register argument_count_reg,
|
|
|
|
StackArgumentsAccessorReceiverMode receiver_mode =
|
|
|
|
ARGUMENTS_CONTAIN_RECEIVER,
|
|
|
|
int extra_displacement_to_last_argument = 0)
|
|
|
|
: base_reg_(base_reg),
|
|
|
|
argument_count_reg_(argument_count_reg),
|
|
|
|
argument_count_immediate_(0),
|
|
|
|
receiver_mode_(receiver_mode),
|
|
|
|
extra_displacement_to_last_argument_(
|
|
|
|
extra_displacement_to_last_argument) { }
|
|
|
|
|
|
|
|
StackArgumentsAccessor(
|
|
|
|
Register base_reg,
|
|
|
|
const ParameterCount& parameter_count,
|
|
|
|
StackArgumentsAccessorReceiverMode receiver_mode =
|
|
|
|
ARGUMENTS_CONTAIN_RECEIVER,
|
|
|
|
int extra_displacement_to_last_argument = 0)
|
|
|
|
: base_reg_(base_reg),
|
|
|
|
argument_count_reg_(parameter_count.is_reg() ?
|
|
|
|
parameter_count.reg() : no_reg),
|
|
|
|
argument_count_immediate_(parameter_count.is_immediate() ?
|
|
|
|
parameter_count.immediate() : 0),
|
|
|
|
receiver_mode_(receiver_mode),
|
|
|
|
extra_displacement_to_last_argument_(
|
|
|
|
extra_displacement_to_last_argument) { }
|
|
|
|
|
|
|
|
Operand GetArgumentOperand(int index);
|
|
|
|
Operand GetReceiverOperand() {
|
2014-08-04 11:34:54 +00:00
|
|
|
DCHECK(receiver_mode_ == ARGUMENTS_CONTAIN_RECEIVER);
|
2013-10-03 01:22:25 +00:00
|
|
|
return GetArgumentOperand(0);
|
2013-08-27 01:21:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Register base_reg_;
|
|
|
|
const Register argument_count_reg_;
|
|
|
|
const int argument_count_immediate_;
|
|
|
|
const StackArgumentsAccessorReceiverMode receiver_mode_;
|
|
|
|
const int extra_displacement_to_last_argument_;
|
|
|
|
|
|
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(StackArgumentsAccessor);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-09-30 13:46:56 +00:00
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|
2009-05-06 13:27:35 +00:00
|
|
|
|
|
|
|
#endif // V8_X64_CODEGEN_X64_H_
|