Permalink
Browse files

Update V8 to version 3.0 (re-land r5920).

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5922 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
  • Loading branch information...
1 parent 51b494d commit 90b337037493bc04b80d7ffa067abfb439bf33cd kasperl@chromium.org committed Dec 7, 2010
Showing 325 changed files with 51,938 additions and 2,288 deletions.
View
@@ -523,7 +523,8 @@ SAMPLE_FLAGS = {
'CCFLAGS': ['-O2']
},
'mode:debug': {
- 'CCFLAGS': ['-g', '-O0']
+ 'CCFLAGS': ['-g', '-O0'],
+ 'CPPDEFINES': ['DEBUG']
},
'prof:oprofile': {
'LIBPATH': ['/usr/lib32', '/usr/lib32/oprofile'],
@@ -578,13 +579,14 @@ SAMPLE_FLAGS = {
'LINKFLAGS': ['/MACHINE:X64', '/STACK:2091752']
},
'mode:debug': {
- 'CCFLAGS': ['/Od'],
- 'LINKFLAGS': ['/DEBUG'],
+ 'CCFLAGS': ['/Od'],
+ 'LINKFLAGS': ['/DEBUG'],
+ 'CPPDEFINES': ['DEBUG'],
'msvcrt:static': {
- 'CCFLAGS': ['/MTd']
+ 'CCFLAGS': ['/MTd']
},
'msvcrt:shared': {
- 'CCFLAGS': ['/MDd']
+ 'CCFLAGS': ['/MDd']
}
}
}
View
@@ -0,0 +1,99 @@
+// Copyright 2010 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.
+
+#ifndef V8_V8_TEST_H_
+#define V8_V8_TEST_H_
+
+#include "v8.h"
+
+#ifdef _WIN32
+// Setup for Windows DLL export/import. See v8.h in this directory for
+// information on how to build/use V8 as a DLL.
+#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
+#error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\
+ build configuration to ensure that at most one of these is set
+#endif
+
+#ifdef BUILDING_V8_SHARED
+#define V8EXPORT __declspec(dllexport)
+#elif USING_V8_SHARED
+#define V8EXPORT __declspec(dllimport)
+#else
+#define V8EXPORT
+#endif
+
+#else // _WIN32
+
+// Setup for Linux shared library export. See v8.h in this directory for
+// information on how to build/use V8 as shared library.
+#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(V8_SHARED)
+#define V8EXPORT __attribute__ ((visibility("default")))
+#else // defined(__GNUC__) && (__GNUC__ >= 4)
+#define V8EXPORT
+#endif // defined(__GNUC__) && (__GNUC__ >= 4)
+
+#endif // _WIN32
+
+
+/**
+ * Testing support for the V8 JavaScript engine.
+ */
+namespace v8 {
+
+class V8EXPORT Testing {
+ public:
+ enum StressType {
+ kStressTypeOpt,
+ kStressTypeDeopt
+ };
+
+ /**
+ * Set the type of stressing to do. The default if not set is kStressTypeOpt.
+ */
+ static void SetStressRunType(StressType type);
+
+ /**
+ * Get the number of runs of a given test that is required to get the full
+ * stress coverage.
+ */
+ static int GetStressRuns();
+
+ /**
+ * Indicate the number of the run which is about to start. The value of run
+ * should be between 0 and one less than the result from GetStressRuns()
+ */
+ static void PrepareStressRun(int run);
+};
+
+
+} // namespace v8
+
+
+#undef V8EXPORT
+
+
+#endif // V8_V8_TEST_H_
View
@@ -26,6 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <v8.h>
+#include <v8-testing.h>
#include <fcntl.h>
#include <string.h>
#include <stdio.h>
@@ -44,10 +45,10 @@ v8::Handle<v8::Value> Quit(const v8::Arguments& args);
v8::Handle<v8::Value> Version(const v8::Arguments& args);
v8::Handle<v8::String> ReadFile(const char* name);
void ReportException(v8::TryCatch* handler);
+void SetFlagsFromString(const char* flags);
int RunMain(int argc, char* argv[]) {
- v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
v8::HandleScope handle_scope;
// Create a template for the global object.
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
@@ -63,11 +64,11 @@ int RunMain(int argc, char* argv[]) {
global->Set(v8::String::New("version"), v8::FunctionTemplate::New(Version));
// Create a new execution environment containing the built-in
// functions
- v8::Handle<v8::Context> context = v8::Context::New(NULL, global);
- // Enter the newly created execution environment.
- v8::Context::Scope context_scope(context);
+ v8::Persistent<v8::Context> context = v8::Context::New(NULL, global);
bool run_shell = (argc == 1);
for (int i = 1; i < argc; i++) {
+ // Enter the execution environment before evaluating any code.
+ v8::Context::Scope context_scope(context);
const char* str = argv[i];
if (strcmp(str, "--shell") == 0) {
run_shell = true;
@@ -99,12 +100,48 @@ int RunMain(int argc, char* argv[]) {
}
}
if (run_shell) RunShell(context);
+ context.Dispose();
return 0;
}
int main(int argc, char* argv[]) {
- int result = RunMain(argc, argv);
+ // Figure out if we're requested to stress the optimization
+ // infrastructure by running tests multiple times and forcing
+ // optimization in the last run.
+ bool FLAG_stress_opt = false;
+ bool FLAG_stress_deopt = false;
+ for (int i = 0; i < argc; i++) {
+ if (strcmp(argv[i], "--stress-opt") == 0) {
+ FLAG_stress_opt = true;
+ argv[i] = NULL;
+ } else if (strcmp(argv[i], "--stress-deopt") == 0) {
+ FLAG_stress_deopt = true;
+ argv[i] = NULL;
+ } else if (strcmp(argv[i], "--noalways-opt") == 0) {
+ // No support for stressing if we can't use --always-opt.
+ FLAG_stress_opt = false;
+ FLAG_stress_deopt = false;
+ break;
+ }
+ }
+
+ v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
+ int result = 0;
+ if (FLAG_stress_opt || FLAG_stress_deopt) {
+ v8::Testing::SetStressRunType(FLAG_stress_opt
+ ? v8::Testing::kStressTypeOpt
+ : v8::Testing::kStressTypeDeopt);
+ int stress_runs = v8::Testing::GetStressRuns();
+ for (int i = 0; i < stress_runs && result == 0; i++) {
+ printf("============ Stress %d/%d ============\n",
+ i + 1, stress_runs);
+ v8::Testing::PrepareStressRun(i);
+ result = RunMain(argc, argv);
+ }
+ } else {
+ result = RunMain(argc, argv);
+ }
v8::V8::Dispose();
return result;
}
@@ -221,6 +258,8 @@ v8::Handle<v8::String> ReadFile(const char* name) {
void RunShell(v8::Handle<v8::Context> context) {
printf("V8 version %s\n", v8::V8::GetVersion());
static const int kBufferSize = 256;
+ // Enter the execution environment before evaluating any code.
+ v8::Context::Scope context_scope(context);
while (true) {
char buffer[kBufferSize];
printf("> ");
@@ -306,3 +345,8 @@ void ReportException(v8::TryCatch* try_catch) {
}
}
}
+
+
+void SetFlagsFromString(const char* flags) {
+ v8::V8::SetFlagsFromString(flags, strlen(flags));
+}
View
@@ -40,6 +40,7 @@ SOURCES = {
api.cc
assembler.cc
ast.cc
+ atomicops_internals_x86_gcc.cc
bignum.cc
bignum-dtoa.cc
bootstrapper.cc
@@ -59,6 +60,7 @@ SOURCES = {
dateparser.cc
debug-agent.cc
debug.cc
+ deoptimizer.cc
disassembler.cc
diy-fp.cc
dtoa.cc
@@ -76,10 +78,13 @@ SOURCES = {
hashmap.cc
heap-profiler.cc
heap.cc
+ hydrogen.cc
+ hydrogen-instructions.cc
ic.cc
interpreter-irregexp.cc
jsregexp.cc
jump-target.cc
+ lithium-allocator.cc
liveedit.cc
log-utils.cc
log.cc
@@ -99,6 +104,8 @@ SOURCES = {
register-allocator.cc
rewriter.cc
runtime.cc
+ runtime-profiler.cc
+ safepoint-table.cc
scanner-base.cc
scanner.cc
scopeinfo.cc
@@ -134,11 +141,14 @@ SOURCES = {
arm/constants-arm.cc
arm/cpu-arm.cc
arm/debug-arm.cc
+ arm/deoptimizer-arm.cc
arm/disasm-arm.cc
arm/frames-arm.cc
arm/full-codegen-arm.cc
arm/ic-arm.cc
arm/jump-target-arm.cc
+ arm/lithium-arm.cc
+ arm/lithium-codegen-arm.cc
arm/macro-assembler-arm.cc
arm/regexp-macro-assembler-arm.cc
arm/register-allocator-arm.cc
@@ -172,11 +182,14 @@ SOURCES = {
ia32/codegen-ia32.cc
ia32/cpu-ia32.cc
ia32/debug-ia32.cc
+ ia32/deoptimizer-ia32.cc
ia32/disasm-ia32.cc
ia32/frames-ia32.cc
ia32/full-codegen-ia32.cc
ia32/ic-ia32.cc
ia32/jump-target-ia32.cc
+ ia32/lithium-codegen-ia32.cc
+ ia32/lithium-ia32.cc
ia32/macro-assembler-ia32.cc
ia32/regexp-macro-assembler-ia32.cc
ia32/register-allocator-ia32.cc
@@ -192,6 +205,7 @@ SOURCES = {
x64/codegen-x64.cc
x64/cpu-x64.cc
x64/debug-x64.cc
+ x64/deoptimizer-x64.cc
x64/disasm-x64.cc
x64/frames-x64.cc
x64/full-codegen-x64.cc
Oops, something went wrong.

0 comments on commit 90b3370

Please sign in to comment.