Hello there,

I just made v8 to build under FreeBSD 7.2 amd64 (i.e. x86-64
architecture).

I would ask that someone of comitters apply this patch and commit
changes to repository.

It works fine with Python 2.5.4, scons 1.2.0
Also libexecinfo-1.1_3 package was been installed, and its execinfo.h
symlinked as:
$ ln -s /usr/local/include/execinfo.h /usr/include/execinfo.h

I created the patch file with "diff -rupN v8-orig/ v8/ > ./
for_r2938.patch"
and listed it below.
To apply them back against source command line like
 patch -p1 < ./for_r2938.patch
should be called

I also added there hello_world.cpp and its build shell file to check
how it works.

-Regards,
Minas Abrahamyan


===$ cat ./for_r2938.patch: ===
diff -rupN v8-orig/hello_w_make.sh v8/hello_w_make.sh
--- v8-orig/hello_w_make.sh     1970-01-01 04:00:00.000000000 +0400
+++ v8/hello_w_make.sh  2009-09-19 21:49:08.000000000 +0500
@@ -0,0 +1 @@
+g++ -Iinclude hello_world.cpp -o hello_world libv8.a /usr/local/lib/
libexecinfo.a -lpthread
diff -rupN v8-orig/hello_world.cpp v8/hello_world.cpp
--- v8-orig/hello_world.cpp     1970-01-01 04:00:00.000000000 +0400
+++ v8/hello_world.cpp  2009-09-19 21:02:01.000000000 +0500
@@ -0,0 +1,33 @@
+#include <v8.h>
+
+using namespace v8;
+
+int main(int argc, char* argv[]) {
+
+  // Create a stack-allocated handle scope.
+  HandleScope handle_scope;
+
+  // Create a new context.
+  Persistent<Context> context = Context::New();
+
+  // Enter the created context for compiling and
+  // running the hello world script.
+  Context::Scope context_scope(context);
+
+  // Create a string containing the JavaScript source code.
+  Handle<String> source = String::New("'Hello' + ', World!'");
+
+  // Compile the source code.
+  Handle<Script> script = Script::Compile(source);
+
+  // Run the script to get the result.
+  Handle<Value> result = script->Run();
+
+  // Dispose the persistent context.
+  context.Dispose();
+
+  // Convert the result to an ASCII string and print it.
+  String::AsciiValue ascii(result);
+  printf("%s\n", *ascii);
+  return 0;
+}
diff -rupN v8-orig/src/platform-freebsd.cc v8/src/platform-freebsd.cc
--- v8-orig/src/platform-freebsd.cc     2009-09-19 13:04:27.000000000
+0500
+++ v8/src/platform-freebsd.cc  2009-09-19 21:34:59.000000000 +0500
@@ -554,14 +554,21 @@ static void ProfilerSignalHandler(int si
     // Extracting the sample from the context is extremely machine
dependent.
     ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
     mcontext_t& mcontext = ucontext->uc_mcontext;
-#if defined (__arm__) || defined(__thumb__)
+#if V8_HOST_ARCH_IA32
+    sample.pc = mcontext.mc_eip;
+    sample.sp = mcontext.mc_esp;
+    sample.fp = mcontext.mc_ebp;
+#elif V8_HOST_ARCH_X64
+    sample.pc = mcontext.mc_rip;
+    sample.sp = mcontext.mc_rsp;
+    sample.fp = mcontext.mc_rbp;
+#elif V8_HOST_ARCH_ARM and (defined (__arm__) || defined(__thumb__))
+// An undefined macro V8_HOST_ARCH_ARM evaluates to 0, so this
applies to Android's Bionic also.
     sample.pc = mcontext.mc_r15;
     sample.sp = mcontext.mc_r13;
     sample.fp = mcontext.mc_r11;
 #else
-    sample.pc = mcontext.mc_eip;
-    sample.sp = mcontext.mc_esp;
-    sample.fp = mcontext.mc_ebp;
+#error Host arch not supported, FIXME
 #endif
     active_sampler_->SampleStack(&sample);
   }
diff -rupN v8-orig/tools/utils.py v8/tools/utils.py
--- v8-orig/tools/utils.py      2009-09-19 13:03:03.000000000 +0500
+++ v8/tools/utils.py   2009-09-19 19:58:38.000000000 +0500
@@ -63,6 +63,8 @@ def GuessArchitecture():
   id = platform.machine()
   if id.startswith('arm'):
     return 'arm'
+  elif id=='amd64':
+    return 'x64'
   elif (not id) or (not re.match('(x|i[3-6])86', id) is None):
     return 'ia32'
   else:
=== end of cat ===
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to