From c5d1b1f20868bb36ed0a73c239aef624e55c1042 Mon Sep 17 00:00:00 2001 From: jasper Date: Wed, 30 Mar 2011 19:54:29 +0000 Subject: [PATCH] - update node to 0.4.4 with various patches from chrome to make this build --- www/node/Makefile | 12 +- www/node/distinfo | 10 +- www/node/patches/patch-deps_v8_SConstruct | 8 +- .../patch-deps_v8_src_platform-openbsd_cc | 132 ++++++++++++++ .../patch-deps_v8_src_x64_code-stubs-x64_cc | 99 +++++++++++ .../patch-deps_v8_src_x64_codegen-x64_cc | 164 ++++++++++++++++++ .../patch-deps_v8_src_x64_full-codegen-x64_cc | 43 +++++ ...tch-deps_v8_src_x64_lithium-codegen-x64_cc | 12 ++ ...tch-deps_v8_src_x64_macro-assembler-x64_cc | 124 +++++++++++++ ...atch-deps_v8_src_x64_macro-assembler-x64_h | 32 ++++ www/node/patches/patch-wscript | 48 ++--- www/node/pkg/PLIST | 7 +- 12 files changed, 651 insertions(+), 40 deletions(-) create mode 100644 www/node/patches/patch-deps_v8_src_platform-openbsd_cc create mode 100644 www/node/patches/patch-deps_v8_src_x64_code-stubs-x64_cc create mode 100644 www/node/patches/patch-deps_v8_src_x64_codegen-x64_cc create mode 100644 www/node/patches/patch-deps_v8_src_x64_full-codegen-x64_cc create mode 100644 www/node/patches/patch-deps_v8_src_x64_lithium-codegen-x64_cc create mode 100644 www/node/patches/patch-deps_v8_src_x64_macro-assembler-x64_cc create mode 100644 www/node/patches/patch-deps_v8_src_x64_macro-assembler-x64_h diff --git a/www/node/Makefile b/www/node/Makefile index c664a9689bc..b0b3c604697 100644 --- a/www/node/Makefile +++ b/www/node/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.7 2011/03/02 06:29:44 jasper Exp $ +# $OpenBSD: Makefile,v 1.8 2011/03/30 19:54:29 jasper Exp $ # XXX: # - Needs __ARM_NR_cacheflush (or the like) to work on arm-based ports. @@ -8,7 +8,7 @@ ONLY_FOR_ARCHS= amd64 i386 COMMENT= V8 JavaScript for clients and servers -DISTNAME= node-v0.2.6 +DISTNAME= node-v0.4.4 PKGNAME= ${DISTNAME:S/v//g} CATEGORIES= www devel @@ -27,7 +27,7 @@ MODULES= lang/python VMEM_WARNING= Yes -WANTLIB += c crypto execinfo ev kvm m pthread ssl stdc++ z +WANTLIB += c crypto execinfo ev kvm m pthread ssl stdc++ util LIB_DEPENDS= devel/libev \ devel/libexecinfo @@ -37,7 +37,7 @@ CONFIGURE_ARGS+= --shared-libev-libpath="${LOCALBASE}/lib" \ --shared-libev-include="${LOCALBASE}/include" MODPY_ADJ_FILES=wscript \ - bin/node-waf \ + tools/node-waf \ tools/waf-light NO_REGRESS= Yes @@ -46,10 +46,6 @@ SUBST_VARS+= CFLAGS MAKE_ENV+= CXX=c++ CCFLAGS+="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" -post-extract: - rm -f ${WRKSRC}/deps/v8/src/SConscript.orig \ - ${WRKSRC}/deps/v8/src/platform.h.orig - pre-configure: ${SUBST_CMD} ${WRKSRC}/wscript \ ${WRKSRC}/tools/wafadmin/Tools/python.py diff --git a/www/node/distinfo b/www/node/distinfo index b8fa8adc33a..ceade644733 100644 --- a/www/node/distinfo +++ b/www/node/distinfo @@ -1,5 +1,5 @@ -MD5 (node-v0.2.6.tar.gz) = scUM60O+4bIhviELe8eiFg== -RMD160 (node-v0.2.6.tar.gz) = exdTJ5vy9vx8TS7KIBQI6F052qk= -SHA1 (node-v0.2.6.tar.gz) = bHeRUoPrgZFMw57OB7Qd6bXWDDk= -SHA256 (node-v0.2.6.tar.gz) = 6X/pyB/0tWmumg1G5koFcqHxcSk1c6W1KQvMOZahlwE= -SIZE (node-v0.2.6.tar.gz) = 4010320 +MD5 (node-v0.4.4.tar.gz) = ds2U7JtyEpbtOQgbhDnvpQ== +RMD160 (node-v0.4.4.tar.gz) = T0alI3B8S5sr9K8oyybUQeeY8xs= +SHA1 (node-v0.4.4.tar.gz) = nsZBfRT9p8QRXnigWQe0r+LwSGs= +SHA256 (node-v0.4.4.tar.gz) = 6kQwkJYBNAyz6K2xVWn6z+yk4dWRKfGTIlRTW7S/Phc= +SIZE (node-v0.4.4.tar.gz) = 4995935 diff --git a/www/node/patches/patch-deps_v8_SConstruct b/www/node/patches/patch-deps_v8_SConstruct index c8611b168b9..d679f745dec 100644 --- a/www/node/patches/patch-deps_v8_SConstruct +++ b/www/node/patches/patch-deps_v8_SConstruct @@ -1,10 +1,10 @@ -$OpenBSD: patch-deps_v8_SConstruct,v 1.1 2010/12/29 12:24:39 jasper Exp $ +$OpenBSD: patch-deps_v8_SConstruct,v 1.2 2011/03/30 19:54:29 jasper Exp $ Don't link with -lpthread but use -pthread instead. ---- deps/v8/SConstruct.orig Wed Dec 29 13:06:58 2010 -+++ deps/v8/SConstruct Wed Dec 29 13:07:25 2010 -@@ -361,7 +361,8 @@ MKSNAPSHOT_EXTRA_FLAGS = { +--- deps/v8/SConstruct.orig Sat Mar 26 09:48:02 2011 ++++ deps/v8/SConstruct Sat Mar 26 14:32:08 2011 +@@ -369,7 +369,8 @@ MKSNAPSHOT_EXTRA_FLAGS = { 'LINKFLAGS': ['-mt'] }, 'os:openbsd': { diff --git a/www/node/patches/patch-deps_v8_src_platform-openbsd_cc b/www/node/patches/patch-deps_v8_src_platform-openbsd_cc new file mode 100644 index 00000000000..adbb6e035ad --- /dev/null +++ b/www/node/patches/patch-deps_v8_src_platform-openbsd_cc @@ -0,0 +1,132 @@ +$OpenBSD: patch-deps_v8_src_platform-openbsd_cc,v 1.1 2011/03/30 19:54:29 jasper Exp $ +--- deps/v8/src/platform-openbsd.cc.orig Sat Mar 26 09:48:02 2011 ++++ deps/v8/src/platform-openbsd.cc Wed Mar 30 21:21:02 2011 +@@ -1,4 +1,4 @@ +-// Copyright 2006-2009 the V8 project authors. All rights reserved. ++// Copyright 2006-2008 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: +@@ -164,6 +164,7 @@ void* OS::Allocate(const size_t requested, + + + void OS::Free(void* buf, const size_t length) { ++ // TODO(1240712): munmap has a return value which is ignored here. + int result = munmap(buf, length); + USE(result); + ASSERT(result == 0); +@@ -197,13 +198,7 @@ void OS::Abort() { + + + void OS::DebugBreak() { +-#if (defined(__arm__) || defined(__thumb__)) +-# if defined(CAN_USE_ARMV5_INSTRUCTIONS) +- asm("bkpt 0"); +-# endif +-#else + asm("int $3"); +-#endif + } + + +@@ -309,8 +304,30 @@ void OS::SignalCodeMovingGC() { + + + int OS::StackWalk(Vector frames) { +- UNIMPLEMENTED(); +- return 1; ++ int frames_size = frames.length(); ++ ScopedVector addresses(frames_size); ++ ++ int frames_count = backtrace(addresses.start(), frames_size); ++ ++ char** symbols = backtrace_symbols(addresses.start(), frames_count); ++ if (symbols == NULL) { ++ return kStackWalkError; ++ } ++ ++ for (int i = 0; i < frames_count; i++) { ++ frames[i].address = addresses[i]; ++ // Format a text representation of the frame based on the information ++ // available. ++ SNPrintF(MutableCStrVector(frames[i].text, kStackWalkMaxTextLen), ++ "%s", ++ symbols[i]); ++ // Make sure line termination is in place. ++ frames[i].text[kStackWalkMaxTextLen - 1] = '\0'; ++ } ++ ++ free(symbols); ++ ++ return frames_count; + } + + +@@ -502,6 +519,16 @@ class OpenBSDMutex : public Mutex { + return result; + } + ++ virtual bool TryLock() { ++ int result = pthread_mutex_trylock(&mutex_); ++ // Return false if the lock is busy and locking failed. ++ if (result == EBUSY) { ++ return false; ++ } ++ ASSERT(result == 0); // Verify no other errors. ++ return true; ++ } ++ + private: + pthread_mutex_t mutex_; // Pthread mutex for POSIX platforms. + }; +@@ -571,18 +598,37 @@ Semaphore* OS::CreateSemaphore(int count) { + #ifdef ENABLE_LOGGING_AND_PROFILING + + static Sampler* active_sampler_ = NULL; ++static pthread_t vm_tid_ = 0; + ++typedef struct sigcontext ucontext_t; ++ + static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { + USE(info); + if (signal != SIGPROF) return; +- if (active_sampler_ == NULL) return; ++ if (active_sampler_ == NULL || !active_sampler_->IsActive()) return; ++ if (vm_tid_ != pthread_self()) return; + +- TickSample sample; ++ TickSample sample_obj; ++ TickSample* sample = CpuProfiler::TickSampleEvent(); ++ if (sample == NULL) sample = &sample_obj; + +- // We always sample the VM state. +- sample.state = VMState::current_state(); ++ // Extracting the sample from the context is extremely machine dependent. ++ ucontext_t* ucontext = reinterpret_cast(context); ++ sample->state = Top::current_vm_state(); + +- active_sampler_->Tick(&sample); ++#if V8_HOST_ARCH_IA32 ++ sample->pc = reinterpret_cast
(ucontext->sc_eip); ++ sample->sp = reinterpret_cast
(ucontext->sc_esp); ++ sample->fp = reinterpret_cast
(ucontext->sc_ebp); ++#elif V8_HOST_ARCH_X64 ++ sample->pc = reinterpret_cast
(ucontext->sc_rip); ++ sample->sp = reinterpret_cast
(ucontext->sc_rsp); ++ sample->fp = reinterpret_cast
(ucontext->sc_rbp); ++#else ++ UNIMPLEMENTED(); ++#endif ++ active_sampler_->SampleStack(sample); ++ active_sampler_->Tick(sample); + } + + +@@ -616,6 +662,7 @@ void Sampler::Start() { + // There can only be one active sampler at the time on POSIX + // platforms. + if (active_sampler_ != NULL) return; ++ vm_tid_ = pthread_self(); + + // Request profiling signals. + struct sigaction sa; diff --git a/www/node/patches/patch-deps_v8_src_x64_code-stubs-x64_cc b/www/node/patches/patch-deps_v8_src_x64_code-stubs-x64_cc new file mode 100644 index 00000000000..f6711989c60 --- /dev/null +++ b/www/node/patches/patch-deps_v8_src_x64_code-stubs-x64_cc @@ -0,0 +1,99 @@ +$OpenBSD: patch-deps_v8_src_x64_code-stubs-x64_cc,v 1.1 2011/03/30 19:54:29 jasper Exp $ +--- deps/v8/src/x64/code-stubs-x64.cc.orig Sat Mar 26 09:48:02 2011 ++++ deps/v8/src/x64/code-stubs-x64.cc Wed Mar 30 21:21:20 2011 +@@ -2244,11 +2244,14 @@ void ArgumentsAccessStub::GenerateReadElement(MacroAss + Label slow; + __ JumpIfNotSmi(rdx, &slow); + +- // Check if the calling frame is an arguments adaptor frame. ++ // Check if the calling frame is an arguments adaptor frame. We look at the ++ // context offset, and if the frame is not a regular one, then we find a ++ // Smi instead of the context. We can't use SmiCompare here, because that ++ // only works for comparing two smis. + Label adaptor; + __ movq(rbx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); +- __ SmiCompare(Operand(rbx, StandardFrameConstants::kContextOffset), +- Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); ++ __ Cmp(Operand(rbx, StandardFrameConstants::kContextOffset), ++ Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); + __ j(equal, &adaptor); + + // Check index against formal parameters count limit passed in +@@ -2303,8 +2306,8 @@ void ArgumentsAccessStub::GenerateNewObject(MacroAssem + // Check if the calling frame is an arguments adaptor frame. + Label adaptor_frame, try_allocate, runtime; + __ movq(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); +- __ SmiCompare(Operand(rdx, StandardFrameConstants::kContextOffset), +- Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); ++ __ Cmp(Operand(rdx, StandardFrameConstants::kContextOffset), ++ Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); + __ j(equal, &adaptor_frame); + + // Get the length from the frame. +@@ -4082,8 +4085,8 @@ void StringAddStub::Generate(MacroAssembler* masm) { + // Look at the length of the result of adding the two strings. + STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue / 2); + __ SmiAdd(rbx, rbx, rcx); +- // Use the runtime system when adding two one character strings, as it +- // contains optimizations for this specific case using the symbol table. ++ // Use the symbol table when adding two one character strings, as it ++ // helps later optimizations to return a symbol here. + __ SmiCompare(rbx, Smi::FromInt(2)); + __ j(not_equal, &longer_than_two); + +@@ -4435,15 +4438,14 @@ void StringHelper::GenerateTwoCharacterSymbolTableProb + FieldOperand(symbol_table, SymbolTable::kCapacityOffset)); + __ decl(mask); + +- Register undefined = scratch4; +- __ LoadRoot(undefined, Heap::kUndefinedValueRootIndex); ++ Register map = scratch4; + + // Registers + // chars: two character string, char 1 in byte 0 and char 2 in byte 1. + // hash: hash of two character string (32-bit int) + // symbol_table: symbol table + // mask: capacity mask (32-bit int) +- // undefined: undefined value ++ // map: - + // scratch: - + + // Perform a number of probes in the symbol table. +@@ -4458,7 +4460,7 @@ void StringHelper::GenerateTwoCharacterSymbolTableProb + } + __ andl(scratch, mask); + +- // Load the entry from the symble table. ++ // Load the entry from the symbol table. + Register candidate = scratch; // Scratch register contains candidate. + STATIC_ASSERT(SymbolTable::kEntrySize == 1); + __ movq(candidate, +@@ -4468,9 +4470,17 @@ void StringHelper::GenerateTwoCharacterSymbolTableProb + SymbolTable::kElementsStartOffset)); + + // If entry is undefined no string with this hash can be found. +- __ cmpq(candidate, undefined); ++ NearLabel is_string; ++ __ CmpObjectType(candidate, ODDBALL_TYPE, map); ++ __ j(not_equal, &is_string); ++ ++ __ CompareRoot(candidate, Heap::kUndefinedValueRootIndex); + __ j(equal, not_found); ++ // Must be null (deleted entry). ++ __ jmp(&next_probe[i]); + ++ __ bind(&is_string); ++ + // If length is not 2 the string is not a candidate. + __ SmiCompare(FieldOperand(candidate, String::kLengthOffset), + Smi::FromInt(2)); +@@ -4481,8 +4491,7 @@ void StringHelper::GenerateTwoCharacterSymbolTableProb + Register temp = kScratchRegister; + + // Check that the candidate is a non-external ascii string. +- __ movq(temp, FieldOperand(candidate, HeapObject::kMapOffset)); +- __ movzxbl(temp, FieldOperand(temp, Map::kInstanceTypeOffset)); ++ __ movzxbl(temp, FieldOperand(map, Map::kInstanceTypeOffset)); + __ JumpIfInstanceTypeIsNotSequentialAscii( + temp, temp, &next_probe[i]); + diff --git a/www/node/patches/patch-deps_v8_src_x64_codegen-x64_cc b/www/node/patches/patch-deps_v8_src_x64_codegen-x64_cc new file mode 100644 index 00000000000..3ef94d37177 --- /dev/null +++ b/www/node/patches/patch-deps_v8_src_x64_codegen-x64_cc @@ -0,0 +1,164 @@ +$OpenBSD: patch-deps_v8_src_x64_codegen-x64_cc,v 1.1 2011/03/30 19:54:29 jasper Exp $ +--- deps/v8/src/x64/codegen-x64.cc.orig Sat Mar 26 09:48:02 2011 ++++ deps/v8/src/x64/codegen-x64.cc Wed Mar 30 21:21:29 2011 +@@ -760,7 +760,7 @@ void CodeGenerator::ToBoolean(ControlDestination* dest + __ AbortIfNotNumber(value.reg()); + } + // Smi => false iff zero. +- __ SmiCompare(value.reg(), Smi::FromInt(0)); ++ __ Cmp(value.reg(), Smi::FromInt(0)); + if (value.is_smi()) { + value.Unuse(); + dest->Split(not_zero); +@@ -788,7 +788,7 @@ void CodeGenerator::ToBoolean(ControlDestination* dest + dest->false_target()->Branch(equal); + + // Smi => false iff zero. +- __ SmiCompare(value.reg(), Smi::FromInt(0)); ++ __ Cmp(value.reg(), Smi::FromInt(0)); + dest->false_target()->Branch(equal); + Condition is_smi = masm_->CheckSmi(value.reg()); + dest->true_target()->Branch(is_smi); +@@ -1030,7 +1030,7 @@ void CodeGenerator::GenericBinaryOperation(BinaryOpera + true, overwrite_mode); + } else { + // Set the flags based on the operation, type and loop nesting level. +- // Bit operations always assume they likely operate on Smis. Still only ++ // Bit operations always assume they likely operate on smis. Still only + // generate the inline Smi check code if this operation is part of a loop. + // For all other operations only inline the Smi check code for likely smis + // if the operation is part of a loop. +@@ -2102,7 +2102,7 @@ void CodeGenerator::Comparison(AstNode* node, + if (cc == equal) { + Label comparison_done; + __ SmiCompare(FieldOperand(left_side.reg(), String::kLengthOffset), +- Smi::FromInt(1)); ++ Smi::FromInt(1)); + __ j(not_equal, &comparison_done); + uint8_t char_value = + static_cast(String::cast(*right_val)->Get(0)); +@@ -2288,7 +2288,7 @@ void CodeGenerator::ConstantSmiComparison(Condition cc + // CompareStub and the inline code both support all values of cc. + } + // Implement comparison against a constant Smi, inlining the case +- // where both sides are Smis. ++ // where both sides are smis. + left_side->ToRegister(); + Register left_reg = left_side->reg(); + Smi* constant_smi = Smi::cast(*right_side->handle()); +@@ -2298,7 +2298,6 @@ void CodeGenerator::ConstantSmiComparison(Condition cc + __ AbortIfNotSmi(left_reg); + } + // Test smi equality and comparison by signed int comparison. +- // Both sides are smis, so we can use an Immediate. + __ SmiCompare(left_reg, constant_smi); + left_side->Unuse(); + right_side->Unuse(); +@@ -2308,7 +2307,7 @@ void CodeGenerator::ConstantSmiComparison(Condition cc + JumpTarget is_smi; + if (cc == equal) { + // We can do the equality comparison before the smi check. +- __ SmiCompare(left_reg, constant_smi); ++ __ Cmp(left_reg, constant_smi); + dest->true_target()->Branch(equal); + Condition left_is_smi = masm_->CheckSmi(left_reg); + dest->false_target()->Branch(left_is_smi); +@@ -2569,8 +2568,8 @@ void CodeGenerator::CallApplyLazy(Expression* applican + // adaptor frame below it. + Label invoke, adapted; + __ movq(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); +- __ SmiCompare(Operand(rdx, StandardFrameConstants::kContextOffset), +- Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); ++ __ Cmp(Operand(rdx, StandardFrameConstants::kContextOffset), ++ Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); + __ j(equal, &adapted); + + // No arguments adaptor frame. Copy fixed number of arguments. +@@ -3851,7 +3850,7 @@ void CodeGenerator::VisitForInStatement(ForInStatement + __ movq(rbx, rax); + + // If the property has been removed while iterating, we just skip it. +- __ SmiCompare(rbx, Smi::FromInt(0)); ++ __ Cmp(rbx, Smi::FromInt(0)); + node->continue_target()->Branch(equal); + + end_del_check.Bind(); +@@ -6192,15 +6191,15 @@ void CodeGenerator::GenerateIsConstructCall(ZoneListSplit(equal); + } +@@ -6220,8 +6219,8 @@ void CodeGenerator::GenerateArgumentsLength(ZoneListBranch(below); ++ __ CmpObjectType(object.reg(), JS_ARRAY_TYPE, tmp1.reg()); ++ deferred->Branch(not_equal); + __ testb(FieldOperand(tmp1.reg(), Map::kBitFieldOffset), + Immediate(KeyedLoadIC::kSlowCaseBitFieldMask)); + deferred->Branch(not_zero); +@@ -6820,7 +6819,7 @@ void CodeGenerator::GenerateSwapElements(ZoneListBranch(not_equal); + +- // Check that the key is within bounds. Both the key and the length of +- // the JSArray are smis. Use unsigned comparison to handle negative keys. +- __ SmiCompare(FieldOperand(receiver.reg(), JSArray::kLengthOffset), +- key.reg()); +- deferred->Branch(below_equal); +- + // Get the elements array from the receiver and check that it is not a + // dictionary. + __ movq(tmp.reg(), +@@ -8541,6 +8534,14 @@ Result CodeGenerator::EmitKeyedStore(StaticType* key_t + __ cmpq(FieldOperand(tmp.reg(), HeapObject::kMapOffset), + kScratchRegister); + deferred->Branch(not_equal); ++ ++ // Check that the key is within bounds. Both the key and the length of ++ // the JSArray are smis (because the fixed array check above ensures the ++ // elements are in fast case). Use unsigned comparison to handle negative ++ // keys. ++ __ SmiCompare(FieldOperand(receiver.reg(), JSArray::kLengthOffset), ++ key.reg()); ++ deferred->Branch(below_equal); + + // Store the value. + SmiIndex index = diff --git a/www/node/patches/patch-deps_v8_src_x64_full-codegen-x64_cc b/www/node/patches/patch-deps_v8_src_x64_full-codegen-x64_cc new file mode 100644 index 00000000000..c581e0283eb --- /dev/null +++ b/www/node/patches/patch-deps_v8_src_x64_full-codegen-x64_cc @@ -0,0 +1,43 @@ +$OpenBSD: patch-deps_v8_src_x64_full-codegen-x64_cc,v 1.1 2011/03/30 19:54:29 jasper Exp $ +--- deps/v8/src/x64/full-codegen-x64.cc.orig Sat Mar 26 09:48:02 2011 ++++ deps/v8/src/x64/full-codegen-x64.cc Wed Mar 30 21:21:39 2011 +@@ -991,7 +991,7 @@ void FullCodeGenerator::VisitForInStatement(ForInState + __ push(rcx); // Enumerable. + __ push(rbx); // Current entry. + __ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION); +- __ SmiCompare(rax, Smi::FromInt(0)); ++ __ Cmp(rax, Smi::FromInt(0)); + __ j(equal, loop_statement.continue_target()); + __ movq(rbx, rax); + +@@ -2498,15 +2498,15 @@ void FullCodeGenerator::EmitIsConstructCall(ZoneListvalue() == 0) { + testq(dst, dst); +@@ -841,20 +855,41 @@ void MacroAssembler::SmiCompare(Register dst, Smi* src + + + void MacroAssembler::SmiCompare(Register dst, const Operand& src) { ++ if (FLAG_debug_code) { ++ AbortIfNotSmi(dst); ++ AbortIfNotSmi(src); ++ } + cmpq(dst, src); + } + + + void MacroAssembler::SmiCompare(const Operand& dst, Register src) { ++ if (FLAG_debug_code) { ++ AbortIfNotSmi(dst); ++ AbortIfNotSmi(src); ++ } + cmpq(dst, src); + } + + + void MacroAssembler::SmiCompare(const Operand& dst, Smi* src) { ++ if (FLAG_debug_code) { ++ AbortIfNotSmi(dst); ++ } + cmpl(Operand(dst, kSmiShift / kBitsPerByte), Immediate(src->value())); + } + + ++void MacroAssembler::Cmp(const Operand& dst, Smi* src) { ++ // The Operand cannot use the smi register, since we may use the scratch ++ // register to get around the lack of 64 bit immediates in the instruction ++ // set. ++ Register smi_reg = GetSmiConstant(src); ++ ASSERT(!dst.AddressUsesRegister(smi_reg)); ++ cmpq(dst, smi_reg); ++} ++ ++ + void MacroAssembler::SmiCompareInteger32(const Operand& dst, Register src) { + cmpl(Operand(dst, kSmiShift / kBitsPerByte), src); + } +@@ -1339,7 +1374,7 @@ void MacroAssembler::Move(const Operand& dst, Handle source) { + if (source->IsSmi()) { +- SmiCompare(dst, Smi::cast(*source)); ++ Cmp(dst, Smi::cast(*source)); + } else { + Move(kScratchRegister, source); + cmpq(dst, kScratchRegister); +@@ -1349,7 +1384,7 @@ void MacroAssembler::Cmp(Register dst, Handle + + void MacroAssembler::Cmp(const Operand& dst, Handle source) { + if (source->IsSmi()) { +- SmiCompare(dst, Smi::cast(*source)); ++ Cmp(dst, Smi::cast(*source)); + } else { + ASSERT(source->IsHeapObject()); + movq(kScratchRegister, source, RelocInfo::EMBEDDED_OBJECT); +@@ -1719,7 +1754,12 @@ void MacroAssembler::AbortIfSmi(Register object) { + + + void MacroAssembler::AbortIfNotSmi(Register object) { +- NearLabel ok; ++ Condition is_smi = CheckSmi(object); ++ Assert(is_smi, "Operand is not a smi"); ++} ++ ++ ++void MacroAssembler::AbortIfNotSmi(const Operand& object) { + Condition is_smi = CheckSmi(object); + Assert(is_smi, "Operand is not a smi"); + } diff --git a/www/node/patches/patch-deps_v8_src_x64_macro-assembler-x64_h b/www/node/patches/patch-deps_v8_src_x64_macro-assembler-x64_h new file mode 100644 index 00000000000..e36e8406354 --- /dev/null +++ b/www/node/patches/patch-deps_v8_src_x64_macro-assembler-x64_h @@ -0,0 +1,32 @@ +$OpenBSD: patch-deps_v8_src_x64_macro-assembler-x64_h,v 1.1 2011/03/30 19:54:29 jasper Exp $ +--- deps/v8/src/x64/macro-assembler-x64.h.orig Sat Mar 26 09:48:02 2011 ++++ deps/v8/src/x64/macro-assembler-x64.h Wed Mar 30 21:22:09 2011 +@@ -263,8 +263,9 @@ class MacroAssembler: public Assembler { + int power); + + +- // Simple comparison of smis. +- void SmiCompare(Register dst, Register src); ++ // Simple comparison of smis. Both sides must be known smis to use these, ++ // otherwise use Cmp. ++ void SmiCompare(Register smi1, Register smi2); + void SmiCompare(Register dst, Smi* src); + void SmiCompare(Register dst, const Operand& src); + void SmiCompare(const Operand& dst, Register src); +@@ -594,6 +595,8 @@ class MacroAssembler: public Assembler { + void Move(const Operand& dst, Handle source); + void Cmp(Register dst, Handle source); + void Cmp(const Operand& dst, Handle source); ++ void Cmp(Register dst, Smi* src); ++ void Cmp(const Operand& dst, Smi* src); + void Push(Handle source); + + // Emit code to discard a non-negative number of pointer-sized elements +@@ -667,6 +670,7 @@ class MacroAssembler: public Assembler { + + // Abort execution if argument is not a smi. Used in debug code. + void AbortIfNotSmi(Register object); ++ void AbortIfNotSmi(const Operand& object); + + // Abort execution if argument is a string. Used in debug code. + void AbortIfNotString(Register object); diff --git a/www/node/patches/patch-wscript b/www/node/patches/patch-wscript index d700dde554a..c3a369f4e7b 100644 --- a/www/node/patches/patch-wscript +++ b/www/node/patches/patch-wscript @@ -1,19 +1,13 @@ -$OpenBSD: patch-wscript,v 1.3 2011/01/03 10:50:51 jasper Exp $ +$OpenBSD: patch-wscript,v 1.4 2011/03/30 19:54:29 jasper Exp $ -- OpenBSD can also use libkvm and libexecinfo. +- OpenBSD can also use libexecinfo. +- Don't append EV_MULTIPLICITY_EV was it breaks the build with using the + shared libev with an undefined reference to ev_rt_now. +- Adjust some paths. ---- wscript.orig Fri Dec 31 06:00:01 2010 -+++ wscript Mon Jan 3 11:03:56 2011 -@@ -155,7 +155,7 @@ def configure(conf): - conf.env.append_value("CCFLAGS", "-rdynamic") - conf.env.append_value("LINKFLAGS_DL", "-rdynamic") - -- if sys.platform.startswith("freebsd"): -+ if sys.platform.startswith("freebsd") or sys.platform.startswith("openbsd"): - conf.check(lib='kvm', uselib_store='KVM') - - #if Options.options.debug: -@@ -164,7 +164,7 @@ def configure(conf): +--- wscript.orig Sat Mar 26 09:48:02 2011 ++++ wscript Wed Mar 30 21:39:43 2011 +@@ -280,7 +280,7 @@ def configure(conf): if Options.options.efence: conf.check(lib='efence', libpath=['/usr/lib', '/usr/local/lib'], uselib_store='EFENCE') @@ -22,17 +16,29 @@ $OpenBSD: patch-wscript,v 1.3 2011/01/03 10:50:51 jasper Exp $ if not conf.check(lib="execinfo", includes=['/usr/include', '/usr/local/include'], libpath=['/usr/lib', '/usr/local/lib'], -@@ -576,11 +577,10 @@ def build(bld): +@@ -460,8 +460,10 @@ def configure(conf): + # LFS + conf.env.append_value('CPPFLAGS', '-D_LARGEFILE_SOURCE') + conf.env.append_value('CPPFLAGS', '-D_FILE_OFFSET_BITS=64') +- conf.env.append_value('CPPFLAGS', '-DEV_MULTIPLICITY=0') + ++# Disabled, see http://comments.gmane.org/gmane.comp.lang.javascript.nodejs/18924 ++# conf.env.append_value('CPPFLAGS', '-DEV_MULTIPLICITY=0') ++ + # Makes select on windows support more than 64 FDs + if sys.platform.startswith("win32"): + conf.env.append_value('CPPFLAGS', '-DFD_SETSIZE=1024'); +@@ -906,11 +908,10 @@ def build(bld): # Only install the man page if it exists. # Do 'make doc install' to build and install it. if os.path.exists('doc/node.1'): - bld.install_files('${PREFIX}/share/man/man1/', 'doc/node.1') + bld.install_files('${PREFIX}/man/man1/', 'doc/node.1') - bld.install_files('${PREFIX}/bin/', 'bin/*', chmod=0755) -- bld.install_files('${PREFIX}/lib/node/wafadmin', 'tools/wafadmin/*.py') -- bld.install_files('${PREFIX}/lib/node/wafadmin/Tools', 'tools/wafadmin/Tools/*.py') -+ bld.install_files('${PREFIX}/lib/node/wafadmin', 'tools/wafadmin/Node.py') + bld.install_files('${PREFIX}/bin/', 'tools/node-waf', chmod=0755) +- bld.install_files('${LIBDIR}/node/wafadmin', 'tools/wafadmin/*.py') +- bld.install_files('${LIBDIR}/node/wafadmin/Tools', 'tools/wafadmin/Tools/*.py') ++ bld.install_files('${LIBDIR}/node/wafadmin', 'tools/wafadmin/Node.py') - def shutdown(): - Options.options.debug + # create a pkg-config(1) file + node_conf = bld.new_task_gen('subst', before="cxx") diff --git a/www/node/pkg/PLIST b/www/node/pkg/PLIST index 7075b585e4b..17c16799cff 100644 --- a/www/node/pkg/PLIST +++ b/www/node/pkg/PLIST @@ -1,6 +1,5 @@ -@comment $OpenBSD: PLIST,v 1.1.1.1 2010/12/28 18:19:28 jasper Exp $ +@comment $OpenBSD: PLIST,v 1.2 2011/03/30 19:54:29 jasper Exp $ @bin bin/node -bin/node-repl bin/node-waf include/node/ include/node/config.h @@ -12,9 +11,13 @@ include/node/node_events.h include/node/node_object_wrap.h include/node/node_version.h include/node/v8-debug.h +include/node/v8-preparser.h include/node/v8-profiler.h +include/node/v8-testing.h include/node/v8.h +include/node/v8stdint.h lib/node/ lib/node/wafadmin/ lib/node/wafadmin/Node.py +lib/pkgconfig/nodejs.pc @man man/man1/node.1