Permalink
Browse files

Add initial marmlade port

  • Loading branch information...
sbc100 committed Aug 4, 2011
1 parent 05d5a40 commit 5fe2650f0e1d4d538a3c189c6af72d50bb479c42
Showing with 413 additions and 3 deletions.
  1. +11 −0 .gitignore
  2. +17 −0 README.rst
  3. +20 −0 data/app.icf
  4. +63 −0 experimental-libraries.cc
  5. +102 −0 libraries.cc
  6. +5 −0 preinclude.h
  7. +12 −0 shell.mkb
  8. +22 −3 upstream/src/platform-linux.cc
  9. +1 −0 v8.defines.txt
  10. +160 −0 v8.mkb
View
@@ -0,0 +1,11 @@
+build_*_*
+upstream
+*.mdev
+*.msrc
+lib
+run_shell.py
+data/app.config.txt
+iwtrace.txt
+data/development.icf
+run.gdb
+data-ram
View
@@ -0,0 +1,17 @@
+v8 for Marmalade
+================
+
+v8 is google javascript engine:
+
+ http://code.google.com/p/v8/
+
+This is an initial attempt to package it for
+Marmalde. Work on this port has just begun and so far only the gcc x86 version
+of v8 is running on Marmalade.
+
+Since v8 don't produce source archives of releases a full copy of the v8 source
+has been added to git in the "upstream" folder. The "upstream" branch contains
+the prestine version of v8 while the "main" branch contains the Marmalade
+specific modification. Currently the only modifiation of the upstream source is
+to the platform-linux.cc file.
+
View
@@ -0,0 +1,20 @@
+# This file is for configuration settings for your
+# application.
+#
+# The syntax is similar to windows .ini files ie
+#
+# [GroupName]
+# Setting = Value
+#
+# Which can be read by your application using
+# e.g s3eConfigGetString("GroupName", "Setting", string)
+#
+# All settings must be documented in .config.txt files.
+# New settings specific to this application should be
+# documented in app.config.txt
+#
+# Some conditional operations are also permitted, see the
+# S3E documentation for details.
+[s3e]
+SysConsole=1
+MemSize=50000000
View
@@ -0,0 +1,63 @@
+// Copyright 2011 Google Inc. All Rights Reserved.
+
+// This file was generated from .js source files by SCons. If you
+// want to make changes to this file you should either change the
+// javascript source files or the SConstruct script.
+
+#include "v8.h"
+#include "natives.h"
+#include "utils.h"
+
+namespace v8 {
+namespace internal {
+
+ static const byte sources[] = { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 103, 108, 111, 98, 97, 108, 46, 80, 114, 111, 120, 121, 61, 110, 101, 119, 32, 36, 79, 98, 106, 101, 99, 116, 40, 41, 59, 10, 10, 118, 97, 114, 32, 36, 80, 114, 111, 120, 121, 61, 103, 108, 111, 98, 97, 108, 46, 80, 114, 111, 120, 121, 10, 10, 118, 97, 114, 32, 102, 117, 110, 100, 97, 109, 101, 110, 116, 97, 108, 84, 114, 97, 112, 115, 61, 91, 10, 34, 103, 101, 116, 79, 119, 110, 80, 114, 111, 112, 101, 114, 116, 121, 68, 101, 115, 99, 114, 105, 112, 116, 111, 114, 34, 44, 10, 34, 103, 101, 116, 80, 114, 111, 112, 101, 114, 116, 121, 68, 101, 115, 99, 114, 105, 112, 116, 111, 114, 34, 44, 10, 34, 103, 101, 116, 79, 119, 110, 80, 114, 111, 112, 101, 114, 116, 121, 78, 97, 109, 101, 115, 34, 44, 10, 34, 103, 101, 116, 80, 114, 111, 112, 101, 114, 116, 121, 78, 97, 109, 101, 115, 34, 44, 10, 34, 100, 101, 102, 105, 110, 101, 80, 114, 111, 112, 101, 114, 116, 121, 34, 44, 10, 34, 100, 101, 108, 101, 116, 101, 34, 44, 10, 34, 102, 105, 120, 34, 44, 10, 93, 10, 10, 118, 97, 114, 32, 100, 101, 114, 105, 118, 101, 100, 84, 114, 97, 112, 115, 61, 91, 10, 34, 104, 97, 115, 34, 44, 10, 34, 104, 97, 115, 79, 119, 110, 34, 44, 10, 34, 103, 101, 116, 34, 44, 10, 34, 115, 101, 116, 34, 44, 10, 34, 101, 110, 117, 109, 101, 114, 97, 116, 101, 34, 44, 10, 34, 107, 101, 121, 115, 34, 44, 10, 93, 10, 10, 118, 97, 114, 32, 102, 117, 110, 99, 116, 105, 111, 110, 84, 114, 97, 112, 115, 61, 91, 10, 34, 99, 97, 108, 108, 84, 114, 97, 112, 34, 44, 10, 34, 99, 111, 110, 115, 116, 114, 117, 99, 116, 84, 114, 97, 112, 34, 44, 10, 93, 10, 10, 36, 80, 114, 111, 120, 121, 46, 99, 114, 101, 97, 116, 101, 70, 117, 110, 99, 116, 105, 111, 110, 61, 102, 117, 110, 99, 116, 105, 111, 110, 40, 97, 44, 98, 44, 99, 41, 123, 10, 97, 46, 99, 97, 108, 108, 84, 114, 97, 112, 61, 98, 10, 97, 46, 99, 111, 110, 115, 116, 114, 117, 99, 116, 84, 114, 97, 112, 61, 99, 10, 36, 80, 114, 111, 120, 121, 46, 99, 114, 101, 97, 116, 101, 40, 97, 41, 10, 125, 10, 10, 36, 80, 114, 111, 120, 121, 46, 99, 114, 101, 97, 116, 101, 61, 102, 117, 110, 99, 116, 105, 111, 110, 40, 97, 44, 98, 41, 123, 10, 105, 102, 40, 33, 40, 37, 95, 73, 115, 83, 112, 101, 99, 79, 98, 106, 101, 99, 116, 40, 97, 41, 41, 41, 10, 116, 104, 114, 111, 119, 32, 77, 97, 107, 101, 84, 121, 112, 101, 69, 114, 114, 111, 114, 40, 34, 104, 97, 110, 100, 108, 101, 114, 95, 110, 111, 110, 95, 111, 98, 106, 101, 99, 116, 34, 44, 91, 34, 99, 114, 101, 97, 116, 101, 34, 93, 41, 10, 105, 102, 40, 33, 40, 37, 95, 73, 115, 83, 112, 101, 99, 79, 98, 106, 101, 99, 116, 40, 98, 41, 41, 41, 98, 61, 110, 117, 108, 108, 10, 114, 101, 116, 117, 114, 110, 32, 37, 67, 114, 101, 97, 116, 101, 74, 83, 80, 114, 111, 120, 121, 40, 97, 44, 98, 41, 10, 125, 10, 10, 10, 10, 10, 10, 10, 10, 10, 102, 117, 110, 99, 116, 105, 111, 110, 32, 68, 101, 114, 105, 118, 101, 100, 71, 101, 116, 84, 114, 97, 112, 40, 97, 44, 98, 41, 123, 10, 118, 97, 114, 32, 99, 61, 116, 104, 105, 115, 46, 103, 101, 116, 80, 114, 111, 112, 101, 114, 116, 121, 68, 101, 115, 99, 114, 105, 112, 116, 111, 114, 40, 98, 41, 10, 105, 102, 40, 40, 116, 121, 112, 101, 111, 102, 40, 99, 41, 61, 61, 61, 39, 117, 110, 100, 101, 102, 105, 110, 101, 100, 39, 41, 41, 123, 114, 101, 116, 117, 114, 110, 32, 99, 125, 10, 105, 102, 40, 39, 118, 97, 108, 117, 101, 39, 105, 110, 32, 99, 41, 123, 10, 114, 101, 116, 117, 114, 110, 32, 99, 46, 118, 97, 108, 117, 101, 10, 125, 101, 108, 115, 101, 123, 10, 105, 102, 40, 40, 116, 121, 112, 101, 111, 102, 40, 99, 46, 103, 101, 116, 41, 61, 61, 61, 39, 117, 110, 100, 101, 102, 105, 110, 101, 100, 39, 41, 41, 123, 114, 101, 116, 117, 114, 110, 32, 99, 46, 103, 101, 116, 125, 10, 10, 114, 101, 116, 117, 114, 110, 32, 37, 95, 67, 97, 108, 108, 70, 117, 110, 99, 116, 105, 111, 110, 40, 97, 44, 99, 46, 103, 101, 116, 41, 10, 125, 10, 125, 10, 10, 102, 117, 110, 99, 116, 105, 111, 110, 32, 68, 101, 114, 105, 118, 101, 100, 83, 101, 116, 84, 114, 97, 112, 40, 97, 44, 98, 44, 99, 41, 123, 10, 118, 97, 114, 32, 100, 61, 116, 104, 105, 115, 46, 103, 101, 116, 79, 119, 110, 80, 114, 111, 112, 101, 114, 116, 121, 68, 101, 115, 99, 114, 105, 112, 116, 111, 114, 40, 98, 41, 10, 105, 102, 40, 100, 41, 123, 10, 105, 102, 40, 39, 119, 114, 105, 116, 97, 98, 108, 101, 39, 105, 110, 32, 100, 41, 123, 10, 105, 102, 40, 100, 46, 119, 114, 105, 116, 97, 98, 108, 101, 41, 123, 10, 100, 46, 118, 97, 108, 117, 101, 61, 99, 10, 116, 104, 105, 115, 46, 100, 101, 102, 105, 110, 101, 80, 114, 111, 112, 101, 114, 116, 121, 40, 98, 44, 100, 41, 10, 114, 101, 116, 117, 114, 110, 32, 116, 114, 117, 101, 10, 125, 101, 108, 115, 101, 123, 10, 114, 101, 116, 117, 114, 110, 32, 102, 97, 108, 115, 101, 10, 125, 10, 125, 101, 108, 115, 101, 123, 10, 105, 102, 40, 100, 46, 115, 101, 116, 41, 123, 10, 10, 37, 95, 67, 97, 108, 108, 70, 117, 110, 99, 116, 105, 111, 110, 40, 97, 44, 99, 44, 100, 46, 115, 101, 116, 41, 10, 114, 101, 116, 117, 114, 110, 32, 116, 114, 117, 101, 10, 125, 101, 108, 115, 101, 123, 10, 114, 101, 116, 117, 114, 110, 32, 102, 97, 108, 115, 101, 10, 125, 10, 125, 10, 125, 10, 100, 61, 116, 104, 105, 115, 46, 103, 101, 116, 80, 114, 111, 112, 101, 114, 116, 121, 68, 101, 115, 99, 114, 105, 112, 116, 111, 114, 40, 98, 41, 10, 105, 102, 40, 100, 41, 123, 10, 105, 102, 40, 39, 119, 114, 105, 116, 97, 98, 108, 101, 39, 105, 110, 32, 100, 41, 123, 10, 105, 102, 40, 100, 46, 119, 114, 105, 116, 97, 98, 108, 101, 41, 123, 10, 10, 125, 101, 108, 115, 101, 123, 10, 114, 101, 116, 117, 114, 110, 32, 102, 97, 108, 115, 101, 10, 125, 10, 125, 101, 108, 115, 101, 123, 10, 105, 102, 40, 100, 46, 115, 101, 116, 41, 123, 10, 10, 37, 95, 67, 97, 108, 108, 70, 117, 110, 99, 116, 105, 111, 110, 40, 97, 44, 99, 44, 100, 46, 115, 101, 116, 41, 10, 114, 101, 116, 117, 114, 110, 32, 116, 114, 117, 101, 10, 125, 101, 108, 115, 101, 123, 10, 114, 101, 116, 117, 114, 110, 32, 102, 97, 108, 115, 101, 10, 125, 10, 125, 10, 125, 10, 116, 104, 105, 115, 46, 100, 101, 102, 105, 110, 101, 80, 114, 111, 112, 101, 114, 116, 121, 40, 98, 44, 123, 10, 118, 97, 108, 117, 101, 58, 99, 44, 10, 119, 114, 105, 116, 97, 98, 108, 101, 58, 116, 114, 117, 101, 44, 10, 101, 110, 117, 109, 101, 114, 97, 98, 108, 101, 58, 116, 114, 117, 101, 44, 10, 99, 111, 110, 102, 105, 103, 117, 114, 97, 98, 108, 101, 58, 116, 114, 117, 101, 125, 41, 59, 10, 114, 101, 116, 117, 114, 110, 32, 116, 114, 117, 101, 59, 10, 125, 10, 10, 102, 117, 110, 99, 116, 105, 111, 110, 32, 68, 101, 114, 105, 118, 101, 100, 72, 97, 115, 84, 114, 97, 112, 40, 97, 41, 123, 10, 114, 101, 116, 117, 114, 110, 33, 33, 116, 104, 105, 115, 46, 103, 101, 116, 80, 114, 111, 112, 101, 114, 116, 121, 68, 101, 115, 99, 114, 105, 112, 116, 111, 114, 40, 97, 41, 10, 125, 10, 10, 102, 117, 110, 99, 116, 105, 111, 110, 32, 68, 101, 114, 105, 118, 101, 100, 72, 97, 115, 79, 119, 110, 84, 114, 97, 112, 40, 97, 41, 123, 10, 114, 101, 116, 117, 114, 110, 33, 33, 116, 104, 105, 115, 46, 103, 101, 116, 79, 119, 110, 80, 114, 111, 112, 101, 114, 116, 121, 68, 101, 115, 99, 114, 105, 112, 116, 111, 114, 40, 97, 41, 10, 125, 10, 10, 102, 117, 110, 99, 116, 105, 111, 110, 32, 68, 101, 114, 105, 118, 101, 100, 75, 101, 121, 115, 84, 114, 97, 112, 40, 41, 123, 10, 118, 97, 114, 32, 97, 61, 116, 104, 105, 115, 46, 103, 101, 116, 79, 119, 110, 80, 114, 111, 112, 101, 114, 116, 121, 78, 97, 109, 101, 115, 40, 41, 10, 118, 97, 114, 32, 98, 61, 91, 93, 10, 102, 111, 114, 40, 118, 97, 114, 32, 99, 61, 48, 44, 99, 111, 117, 110, 116, 61, 48, 59, 99, 60, 97, 46, 108, 101, 110, 103, 116, 104, 59, 43, 43, 99, 41, 123, 10, 118, 97, 114, 32, 100, 61, 97, 91, 99, 93, 10, 105, 102, 40, 116, 104, 105, 115, 46, 103, 101, 116, 79, 119, 110, 80, 114, 111, 112, 101, 114, 116, 121, 68, 101, 115, 99, 114, 105, 112, 116, 111, 114, 40, 40, 40, 116, 121, 112, 101, 111, 102, 40, 37, 73, 83, 95, 86, 65, 82, 40, 100, 41, 41, 61, 61, 61, 39, 115, 116, 114, 105, 110, 103, 39, 41, 63, 100, 58, 78, 111, 110, 83, 116, 114, 105, 110, 103, 84, 111, 83, 116, 114, 105, 110, 103, 40, 100, 41, 41, 41, 46, 101, 110, 117, 109, 101, 114, 97, 98, 108, 101, 41, 123, 10, 98, 91, 99, 111, 117, 110, 116, 43, 43, 93, 61, 97, 91, 99, 93, 10, 125, 10, 125, 10, 114, 101, 116, 117, 114, 110, 32, 98, 10, 125, 10, 10 };
+
+ static const char* raw_sources = reinterpret_cast<const char*>(sources);
+
+ template <>
+ int NativesCollection<EXPERIMENTAL>::GetBuiltinsCount() {
+ return 1;
+ }
+
+ template <>
+ int NativesCollection<EXPERIMENTAL>::GetDebuggerCount() {
+ return 0;
+ }
+
+ template <>
+ int NativesCollection<EXPERIMENTAL>::GetIndex(const char* name) {
+ if (strcmp(name, "proxy") == 0) return 0;
+ return -1;
+ }
+
+ template <>
+ int NativesCollection<EXPERIMENTAL>::GetRawScriptsSize() {
+ return 1806;
+ }
+
+ template <>
+ Vector<const char> NativesCollection<EXPERIMENTAL>::GetRawScriptSource(int index) {
+ if (index == 0) return Vector<const char>(raw_sources + 0, 1806);
+ return Vector<const char>("", 0);
+ }
+
+ template <>
+ Vector<const char> NativesCollection<EXPERIMENTAL>::GetScriptName(int index) {
+ if (index == 0) return Vector<const char>("native proxy.js", 15);
+ return Vector<const char>("", 0);
+ }
+
+ template <>
+ Vector<const byte> NativesCollection<EXPERIMENTAL>::GetScriptsSource() {
+ return Vector<const byte>(sources, 1806);
+ }
+
+ template <>
+ void NativesCollection<EXPERIMENTAL>::SetRawScriptsSource(Vector<const char> raw_source) {
+ ASSERT(1806 == raw_source.length());
+ raw_sources = raw_source.start();
+ }
+
+} // internal
+} // v8
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -0,0 +1,5 @@
+#ifdef I3D_ARCH_X86
+ #define V8_TARGET_ARCH_IA32 1
+#else
+ #error "oops"
+#endif
View
@@ -0,0 +1,12 @@
+#!/usr/bin/env mkb
+library ".,v8"
+
+define S3E_NO_INLINE
+
+includepath "upstream/include"
+
+files
+{
+ ("upstream/samples")
+ shell.cc
+}
@@ -34,7 +34,9 @@
#include <sys/prctl.h>
#include <sys/time.h>
#include <sys/resource.h>
+#ifndef __S3E__
#include <sys/syscall.h>
+#endif
#include <sys/types.h>
#include <stdlib.h>
@@ -79,6 +81,9 @@ static Mutex* limit_mutex = NULL;
static void* GetRandomMmapAddr() {
+#ifdef __S3E__
+ return 0;
+#endif
Isolate* isolate = Isolate::UncheckedCurrent();
// Note that the current isolate isn't set up in a call path via
// CpuFeatures::Probe. We don't care about randomization in this case because
@@ -337,20 +342,28 @@ void OS::ReleaseStore(volatile AtomicWord* ptr, AtomicWord value) {
const char* OS::LocalTimezone(double time) {
+#ifdef __S3E__
+ return tzname[0];
+#else
if (isnan(time)) return "";
time_t tv = static_cast<time_t>(floor(time/msPerSecond));
struct tm* t = localtime(&tv);
if (NULL == t) return "";
return t->tm_zone;
+#endif
}
double OS::LocalTimeOffset() {
+#ifdef __S3E__
+ return 0;
+#else
time_t tv = time(NULL);
struct tm* t = localtime(&tv);
// tm_gmtoff includes any daylight savings offset, so subtract it.
return static_cast<double>(t->tm_gmtoff * msPerSecond -
(t->tm_isdst > 0 ? 3600 * msPerSecond : 0));
+#endif
}
@@ -606,7 +619,7 @@ static const int kMmapFdOffset = 0;
VirtualMemory::VirtualMemory(size_t size) {
- address_ = mmap(GetRandomMmapAddr(), size, PROT_NONE,
+ address_ = mmap(NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE,
kMmapFd, kMmapFdOffset);
size_ = size;
@@ -626,12 +639,14 @@ bool VirtualMemory::IsReserved() {
bool VirtualMemory::Commit(void* address, size_t size, bool is_executable) {
+/*
int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0);
if (MAP_FAILED == mmap(address, size, prot,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED,
kMmapFd, kMmapFdOffset)) {
return false;
}
+ */
UpdateAllocatedSpaceLimits(address, size);
return true;
@@ -887,7 +902,9 @@ enum ArmRegisters {R15 = 15, R13 = 13, R11 = 11};
static int GetThreadID() {
// Glibc doesn't provide a wrapper for gettid(2).
-#if defined(ANDROID)
+#if defined(__S3E__)
+ return pthread_self();
+#elif defined(ANDROID)
return syscall(__NR_gettid);
#else
return syscall(SYS_gettid);
@@ -896,7 +913,7 @@ static int GetThreadID() {
static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) {
-#ifndef V8_HOST_ARCH_MIPS
+#if 0 //ndef V8_HOST_ARCH_MIPS
USE(info);
if (signal != SIGPROF) return;
Isolate* isolate = Isolate::UncheckedCurrent();
@@ -1072,10 +1089,12 @@ class SignalSender : public Thread {
void SendProfilingSignal(int tid) {
if (!signal_handler_installed_) return;
// Glibc doesn't provide a wrapper for tgkill(2).
+#ifndef __S3E__
#if defined(ANDROID)
syscall(__NR_tgkill, vm_tgid_, tid, SIGPROF);
#else
syscall(SYS_tgkill, vm_tgid_, tid, SIGPROF);
+#endif
#endif
}
View
@@ -0,0 +1 @@
+ENABLE_DEBUGGER_SUPPORT enable debugger support
Oops, something went wrong.

0 comments on commit 5fe2650

Please sign in to comment.