X64: Remove temporary compiler and assembler tests, now that shell runs.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2297 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
whesse@chromium.org 2009-06-29 15:04:24 +00:00
parent da61eb8b1e
commit a7c7d67d3a
5 changed files with 8 additions and 154 deletions

View File

@ -1113,8 +1113,8 @@ bool Genesis::InstallNatives() {
}
#ifdef V8_HOST_ARCH_64_BIT
// TODO(X64): Remove this test when code generation works and is stable.
CodeGenerator::TestCodeGenerator();
// TODO(X64): Remove this when inline caches work.
FLAG_use_ic = false;
#endif // V8_HOST_ARCH_64_BIT

View File

@ -25,9 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// TODO(X64): Remove stdio.h when compiler test is removed.
#include <stdio.h>
#include "v8.h"
#include "bootstrapper.h"
@ -38,9 +35,6 @@
#include "register-allocator-inl.h"
#include "scopes.h"
// TODO(X64): Remove compiler.h when compiler test is removed.
#include "compiler.h"
namespace v8 {
namespace internal {
@ -138,81 +132,6 @@ void CodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
}
void CodeGenerator::TestCodeGenerator() {
// Compile a function from a string, and run it.
// Set flags appropriately for this stage of implementation.
// TODO(X64): Make ic work, and stop disabling them.
// These settings stick - remove them when we don't want them anymore.
#ifdef DEBUG
FLAG_print_builtin_source = true;
FLAG_print_builtin_ast = true;
#endif
FLAG_use_ic = false;
// Read the file "test.js" from the current directory, compile, and run it.
// If the file is not there, use a simple script embedded here instead.
Handle<String> test_script;
FILE* file = fopen("test.js", "rb");
if (file == NULL) {
test_script = Factory::NewStringFromAscii(CStrVector(
"// Put all code in anonymous function to avoid global scope.\n"
"(function(){"
" var x = true ? 47 : 32;"
" return x;"
"})()"));
} else {
fseek(file, 0, SEEK_END);
int size = ftell(file);
rewind(file);
char* chars = new char[size + 1];
chars[size] = '\0';
for (int i = 0; i < size;) {
int read = fread(&chars[i], 1, size - i, file);
i += read;
}
fclose(file);
test_script = Factory::NewStringFromAscii(CStrVector(chars));
delete[] chars;
}
Handle<JSFunction> test_function = Compiler::Compile(
test_script,
Factory::NewStringFromAscii(CStrVector("CodeGeneratorTestScript")),
0,
0,
NULL,
NULL);
Code* code_object = test_function->code(); // Local for debugging ease.
USE(code_object);
// Create a dummy function and context.
Handle<JSFunction> bridge =
Factory::NewFunction(Factory::empty_symbol(), Factory::undefined_value());
Handle<Context> context =
Factory::NewFunctionContext(Context::MIN_CONTEXT_SLOTS, bridge);
test_function = Factory::NewFunctionFromBoilerplate(
test_function,
context);
bool pending_exceptions;
Handle<Object> result =
Execution::Call(test_function,
Handle<Object>::cast(test_function),
0,
NULL,
&pending_exceptions);
// Function compiles and runs, but returns a JSFunction object.
#ifdef DEBUG
PrintF("Result of test function: ");
result->Print();
#endif
}
void CodeGenerator::GenCode(FunctionLiteral* function) {
// Record the position for debugging purposes.
CodeForFunctionPosition(function);
@ -2227,12 +2146,12 @@ void CodeGenerator::VisitArrayLiteral(ArrayLiteral* node) {
Result elements = frame_->Pop();
elements.ToRegister();
frame_->Spill(elements.reg());
// Get the elements array.
// Get the elements FixedArray.
__ movq(elements.reg(),
FieldOperand(elements.reg(), JSObject::kElementsOffset));
// Write to the indexed properties array.
int offset = i * kPointerSize + Array::kHeaderSize;
int offset = i * kPointerSize + FixedArray::kHeaderSize;
__ movq(FieldOperand(elements.reg(), offset), prop_value.reg());
// Update the write barrier for the array address.
@ -3227,10 +3146,11 @@ void CodeGenerator::VisitCompareOperation(CompareOperation* node) {
// It can be an undetectable object.
__ movq(kScratchRegister,
FieldOperand(answer.reg(), HeapObject::kMapOffset));
__ movb(kScratchRegister,
FieldOperand(kScratchRegister, Map::kBitFieldOffset));
__ testb(kScratchRegister, Immediate(1 << Map::kIsUndetectable));
__ testb(FieldOperand(kScratchRegister, Map::kBitFieldOffset),
Immediate(1 << Map::kIsUndetectable));
destination()->false_target()->Branch(not_zero);
__ movb(kScratchRegister,
FieldOperand(kScratchRegister, Map::kInstanceTypeOffset));
__ cmpb(kScratchRegister, Immediate(FIRST_JS_OBJECT_TYPE));
destination()->false_target()->Branch(below);
__ cmpb(kScratchRegister, Immediate(LAST_JS_OBJECT_TYPE));
@ -6737,8 +6657,6 @@ void GenericBinaryOpStub::Generate(MacroAssembler* masm) {
// If all else fails, use the runtime system to get the correct
// result.
__ bind(&call_runtime);
// Disable builtin-calls until JS builtins can compile and run.
__ Abort("Disabled until builtins compile and run.");
switch (op_) {
case Token::ADD:
__ InvokeBuiltin(Builtins::ADD, JUMP_FUNCTION);

View File

@ -294,15 +294,6 @@ class CodeGenerator: public AstVisitor {
Handle<Script> script,
bool is_eval);
// During implementation of CodeGenerator, this call creates a
// CodeGenerator instance, and calls GenCode on it with a null
// function literal. CodeGenerator will then construct and return
// a simple dummy function. Call this during bootstrapping before
// trying to compile any real functions, to get CodeGenerator up
// and running.
// TODO(X64): Remove once we can get through the bootstrapping process.
static void TestCodeGenerator();
#ifdef ENABLE_LOGGING_AND_PROFILING
static bool ShouldGenerateLog(Expression* type);
#endif

View File

@ -79,51 +79,6 @@ void MacroAssembler::NegativeZeroTest(Register result,
}
void MacroAssembler::ConstructAndTestJSFunction() {
const int initial_buffer_size = 4 * KB;
char* buffer = new char[initial_buffer_size];
MacroAssembler masm(buffer, initial_buffer_size);
const uint64_t secret = V8_INT64_C(0xdeadbeefcafebabe);
Handle<String> constant =
Factory::NewStringFromAscii(Vector<const char>("451", 3), TENURED);
#define __ ACCESS_MASM((&masm))
// Construct a simple JSfunction here, using Assembler and MacroAssembler
// commands.
__ movq(rax, constant, RelocInfo::EMBEDDED_OBJECT);
__ push(rax);
__ CallRuntime(Runtime::kStringParseFloat, 1);
__ movq(kScratchRegister, secret, RelocInfo::NONE);
__ addq(rax, kScratchRegister);
__ ret(0);
#undef __
CodeDesc desc;
masm.GetCode(&desc);
Code::Flags flags = Code::ComputeFlags(Code::FUNCTION);
Object* code = Heap::CreateCode(desc, NULL, flags, Handle<Object>::null());
if (!code->IsFailure()) {
Handle<Code> code_handle(Code::cast(code));
Handle<String> name =
Factory::NewStringFromAscii(Vector<const char>("foo", 3), NOT_TENURED);
Handle<JSFunction> function =
Factory::NewFunction(name,
JS_FUNCTION_TYPE,
JSObject::kHeaderSize,
code_handle,
true);
bool pending_exceptions;
Handle<Object> result =
Execution::Call(function,
Handle<Object>::cast(function),
0,
NULL,
&pending_exceptions);
CHECK(result->IsSmi());
CHECK(secret + (451 << kSmiTagSize) == reinterpret_cast<uint64_t>(*result));
}
}
void MacroAssembler::Abort(const char* msg) {
// We want to pass the msg string like a smi to avoid GC
// problems, however msg is not guaranteed to be aligned

View File

@ -66,16 +66,6 @@ class MacroAssembler: public Assembler {
public:
MacroAssembler(void* buffer, int size);
// ---------------------------------------------------------------------------
// x64 Implementation Support
// Test the MacroAssembler by constructing and calling a simple JSFunction.
// Cannot be done using API because this must be done in the middle of the
// bootstrapping process.
// TODO(X64): Remove once we can get through the bootstrapping process.
static void ConstructAndTestJSFunction();
// ---------------------------------------------------------------------------
// GC Support