summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/test-compiler.cc
diff options
context:
space:
mode:
authorRefael Ackermann <refack@gmail.com>2014-09-29 13:20:04 +0400
committerFedor Indutny <fedor@indutny.com>2014-10-08 15:35:57 +0400
commit939278ac059b44439d41aab12bf552c8ae3c52d0 (patch)
tree86c586915a96d308b1b04de679a8ae293caf3e41 /deps/v8/test/cctest/test-compiler.cc
parent4412a71d76a0fa002f627ec21d2337e089da6764 (diff)
downloadnode-new-939278ac059b44439d41aab12bf552c8ae3c52d0.tar.gz
deps: update v8 to 3.28.73
Reviewed-By: Fedor Indutny <fedor@indutny.com> PR-URL: https://github.com/joyent/node/pull/8476
Diffstat (limited to 'deps/v8/test/cctest/test-compiler.cc')
-rw-r--r--deps/v8/test/cctest/test-compiler.cc45
1 files changed, 21 insertions, 24 deletions
diff --git a/deps/v8/test/cctest/test-compiler.cc b/deps/v8/test/cctest/test-compiler.cc
index 9974ff5702..2d913715e1 100644
--- a/deps/v8/test/cctest/test-compiler.cc
+++ b/deps/v8/test/cctest/test-compiler.cc
@@ -28,11 +28,12 @@
#include <stdlib.h>
#include <wchar.h>
-#include "v8.h"
+#include "src/v8.h"
-#include "compiler.h"
-#include "disasm.h"
-#include "cctest.h"
+#include "src/compiler.h"
+#include "src/disasm.h"
+#include "src/parser.h"
+#include "test/cctest/cctest.h"
using namespace v8::internal;
@@ -49,7 +50,7 @@ static void SetGlobalProperty(const char* name, Object* value) {
Handle<String> internalized_name =
isolate->factory()->InternalizeUtf8String(name);
Handle<JSObject> global(isolate->context()->global_object());
- Runtime::SetObjectProperty(isolate, global, internalized_name, object, NONE,
+ Runtime::SetObjectProperty(isolate, global, internalized_name, object,
SLOPPY).Check();
}
@@ -58,15 +59,10 @@ static Handle<JSFunction> Compile(const char* source) {
Isolate* isolate = CcTest::i_isolate();
Handle<String> source_code = isolate->factory()->NewStringFromUtf8(
CStrVector(source)).ToHandleChecked();
- Handle<SharedFunctionInfo> shared_function =
- Compiler::CompileScript(source_code,
- Handle<String>(),
- 0,
- 0,
- false,
- Handle<Context>(isolate->native_context()),
- NULL, NULL, NO_CACHED_DATA,
- NOT_NATIVES_CODE);
+ Handle<SharedFunctionInfo> shared_function = Compiler::CompileScript(
+ source_code, Handle<String>(), 0, 0, false,
+ Handle<Context>(isolate->native_context()), NULL, NULL,
+ v8::ScriptCompiler::kNoCompileOptions, NOT_NATIVES_CODE);
return isolate->factory()->NewFunctionFromSharedFunctionInfo(
shared_function, isolate->native_context());
}
@@ -75,7 +71,7 @@ static Handle<JSFunction> Compile(const char* source) {
static double Inc(Isolate* isolate, int x) {
const char* source = "result = %d + 1;";
EmbeddedVector<char, 512> buffer;
- OS::SNPrintF(buffer, source, x);
+ SNPrintF(buffer, source, x);
Handle<JSFunction> fun = Compile(buffer.start());
if (fun.is_null()) return -1;
@@ -278,7 +274,7 @@ TEST(GetScriptLineNumber) {
for (int i = 0; i < max_rows; ++i) {
if (i > 0)
buffer[i - 1] = '\n';
- OS::MemCopy(&buffer[i], function_f, sizeof(function_f) - 1);
+ MemCopy(&buffer[i], function_f, sizeof(function_f) - 1);
v8::Handle<v8::String> script_body =
v8::String::NewFromUtf8(CcTest::isolate(), buffer.start());
v8::Script::Compile(script_body, &origin)->Run();
@@ -313,8 +309,9 @@ TEST(FeedbackVectorPreservedAcrossRecompiles) {
Handle<FixedArray> feedback_vector(f->shared()->feedback_vector());
// Verify that we gathered feedback.
- CHECK_EQ(1, feedback_vector->length());
- CHECK(feedback_vector->get(0)->IsJSFunction());
+ int expected_count = FLAG_vector_ics ? 2 : 1;
+ CHECK_EQ(expected_count, feedback_vector->length());
+ CHECK(feedback_vector->get(expected_count - 1)->IsJSFunction());
CompileRun("%OptimizeFunctionOnNextCall(f); f(fun1);");
@@ -322,7 +319,8 @@ TEST(FeedbackVectorPreservedAcrossRecompiles) {
// of the full code.
CHECK(f->IsOptimized());
CHECK(f->shared()->has_deoptimization_support());
- CHECK(f->shared()->feedback_vector()->get(0)->IsJSFunction());
+ CHECK(f->shared()->feedback_vector()->
+ get(expected_count - 1)->IsJSFunction());
}
@@ -348,16 +346,15 @@ TEST(FeedbackVectorUnaffectedByScopeChanges) {
*v8::Handle<v8::Function>::Cast(
CcTest::global()->Get(v8_str("morphing_call"))));
- // morphing_call should have one feedback vector slot for the call to
- // call_target().
- CHECK_EQ(1, f->shared()->feedback_vector()->length());
+ int expected_count = FLAG_vector_ics ? 2 : 1;
+ CHECK_EQ(expected_count, f->shared()->feedback_vector()->length());
// And yet it's not compiled.
CHECK(!f->shared()->is_compiled());
CompileRun("morphing_call();");
// The vector should have the same size despite the new scoping.
- CHECK_EQ(1, f->shared()->feedback_vector()->length());
+ CHECK_EQ(expected_count, f->shared()->feedback_vector()->length());
CHECK(f->shared()->is_compiled());
}
@@ -422,7 +419,7 @@ static void CheckCodeForUnsafeLiteral(Handle<JSFunction> f) {
v8::internal::EmbeddedVector<char, 128> decode_buffer;
v8::internal::EmbeddedVector<char, 128> smi_hex_buffer;
Smi* smi = Smi::FromInt(12345678);
- OS::SNPrintF(smi_hex_buffer, "0x%lx", reinterpret_cast<intptr_t>(smi));
+ SNPrintF(smi_hex_buffer, "0x%" V8PRIxPTR, reinterpret_cast<intptr_t>(smi));
while (pc < end) {
int num_const = d.ConstantPoolSizeAt(pc);
if (num_const >= 0) {