From f42a9cce98622e5085b3389c3460a7e1e78f7265 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Mon, 16 Oct 2017 22:29:41 -0700 Subject: [PATCH 1/2] src: fix NewContext for --without-intl --- src/node.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node.cc b/src/node.cc index 1bc75abef3f420..ce80ba0ccf4bae 100644 --- a/src/node.cc +++ b/src/node.cc @@ -4777,9 +4777,9 @@ Local NewContext(Isolate* isolate, auto intl_key = FIXED_ONE_BYTE_STRING(isolate, "Intl"); auto break_iter_key = FIXED_ONE_BYTE_STRING(isolate, "v8BreakIterator"); Local intl_v; - Local intl; if (context->Global()->Get(context, intl_key).ToLocal(&intl_v) && - intl_v->ToObject(context).ToLocal(&intl)) { + intl_v->IsObject()) { + Local intl = intl_v.As(); intl->Delete(context, break_iter_key).FromJust(); } return context; From 456ebc3b349f2b6ea3eaa5e8f0da37148baad6f2 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Mon, 16 Oct 2017 22:31:52 -0700 Subject: [PATCH 2/2] benchmark: fix punycode test for --without-intl --- benchmark/misc/punycode.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/benchmark/misc/punycode.js b/benchmark/misc/punycode.js index 630aea3195f098..40bcd70302003c 100644 --- a/benchmark/misc/punycode.js +++ b/benchmark/misc/punycode.js @@ -1,11 +1,14 @@ 'use strict'; const common = require('../common.js'); -const icu = process.binding('icu'); +let icu; +try { + icu = process.binding('icu'); +} catch (err) {} const punycode = require('punycode'); const bench = common.createBenchmark(main, { - method: ['punycode', 'icu'], + method: ['punycode'].concat(icu !== undefined ? ['icu'] : []), n: [1024], val: [ 'افغانستا.icom.museum', @@ -69,8 +72,11 @@ function main(conf) { runPunycode(n, val); break; case 'icu': - runICU(n, val); - break; + if (icu !== undefined) { + runICU(n, val); + break; + } + // fallthrough default: throw new Error('Unexpected method'); }