From 110a38c81d459f22bbec92c9996c30c3380f7f90 Mon Sep 17 00:00:00 2001 From: "ager@chromium.org" Date: Thu, 11 Sep 2008 09:11:10 +0000 Subject: [PATCH] Fixed a number of build issues. Fixed problem with missing I-cache flusing on ARM. Changed space layout in memory management by splitting up code space into old data space and code space. Added utf-8 conversion support to the API (issue 57). Optimized repeated calls to eval with the same strings. These repeated calls are common in web applications. Added Xcode project file. Optimized a couple of Array operation. Fixed parser bug by checking for end-of-string when parsing break and continue (issue 35). Fixed problem where asian characters were not categorized as letters. Fixed bug that disallowed calling functions fetched from an array using a string as an array index (issue 32). Fixed bug where the internal field count on object templates were sometimes ignored (issue 54). Added -f option to the shell sample for compatibility with other engines (issue 18). Added source info to TryCatches in the API. Fixed problem where the seed for the random number generator was clipped in a double to unsigned int conversion. Fixed bug where cons string symbols were sometimes converted to non-symbol flat strings during GC. Fixed bug in error reporting when attempting to convert null to an object. git-svn-id: https://v8.googlecode.com/svn/trunk@267 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- AUTHORS | 11 + ChangeLog | 45 + SConstruct | 40 +- benchmarks/base.js | 2 +- benchmarks/deltablue.js | 2 +- benchmarks/richards.js | 2 +- benchmarks/run.js | 2 +- codereview.settings | 4 + include/v8-debug.h | 8 +- include/v8.h | 119 +- samples/SConscript | 3 +- samples/count-hosts.js | 2 +- samples/process.cc | 14 +- samples/shell.cc | 69 +- src/SConscript | 4 +- src/accessors.cc | 2 +- src/accessors.h | 2 +- src/allocation.cc | 2 +- src/allocation.h | 2 +- src/api.cc | 183 ++- src/api.h | 2 +- src/apinatives.js | 2 +- src/arguments.h | 2 +- src/array.js | 45 +- src/assembler-arm-inl.h | 2 +- src/assembler-arm.cc | 2 +- src/assembler-arm.h | 2 +- src/assembler-ia32-inl.h | 2 +- src/assembler-ia32.cc | 2 +- src/assembler-ia32.h | 2 +- src/assembler.cc | 2 +- src/assembler.h | 2 +- src/ast.cc | 2 +- src/ast.h | 2 +- src/bootstrapper.cc | 2 +- src/bootstrapper.h | 2 +- src/builtins-arm.cc | 2 +- src/builtins-ia32.cc | 2 +- src/builtins.cc | 2 +- src/builtins.h | 2 +- src/char-predicates-inl.h | 2 +- src/char-predicates.h | 2 +- src/checks.cc | 8 +- src/checks.h | 2 +- src/code-stubs.cc | 2 +- src/code-stubs.h | 2 +- src/code.h | 2 +- src/codegen-arm.cc | 17 +- src/codegen-ia32.cc | 16 +- src/codegen-inl.h | 2 +- src/codegen.cc | 6 +- src/codegen.h | 5 +- src/compiler.cc | 2 +- src/compiler.h | 2 +- src/constants-arm.h | 2 +- src/contexts.cc | 2 +- src/contexts.h | 2 +- src/conversions-inl.h | 2 +- src/conversions.cc | 2 +- src/conversions.h | 2 +- src/counters.cc | 2 +- src/counters.h | 2 +- src/cpu-arm.cc | 2 +- src/cpu-ia32.cc | 2 +- src/cpu.h | 2 +- src/date-delay.js | 2 +- src/dateparser.cc | 2 +- src/dateparser.h | 2 +- src/debug-delay.js | 2 +- src/debug.cc | 8 +- src/debug.h | 8 +- src/disasm-arm.cc | 2 +- src/disasm-ia32.cc | 2 +- src/disasm.h | 2 +- src/disassembler.cc | 2 +- src/disassembler.h | 2 +- src/dtoa-config.c | 2 +- src/execution.cc | 9 +- src/execution.h | 2 +- src/factory.cc | 4 +- src/factory.h | 2 +- src/flags-inl.h | 2 +- src/flags.cc | 2 +- src/flags.h | 2 +- src/frames-arm.cc | 2 +- src/frames-arm.h | 2 +- src/frames-ia32.cc | 2 +- src/frames-ia32.h | 2 +- src/frames-inl.h | 2 +- src/frames.cc | 2 +- src/frames.h | 2 +- src/global-handles.cc | 2 +- src/global-handles.h | 2 +- src/globals.h | 18 +- src/handles-inl.h | 2 +- src/handles.cc | 2 +- src/handles.h | 2 +- src/hashmap.cc | 2 +- src/hashmap.h | 2 +- src/heap-inl.h | 45 +- src/heap.cc | 326 +++-- src/heap.h | 99 +- src/ic-arm.cc | 2 +- src/ic-ia32.cc | 2 +- src/ic-inl.h | 2 +- src/ic.cc | 60 +- src/ic.h | 7 +- src/jsregexp.cc | 2 +- src/jsregexp.h | 2 +- src/list-inl.h | 2 +- src/list.h | 2 +- src/log.cc | 2 +- src/log.h | 2 +- src/macro-assembler-arm.cc | 2 +- src/macro-assembler-arm.h | 2 +- src/macro-assembler-ia32.cc | 2 +- src/macro-assembler-ia32.h | 2 +- src/macro-assembler.h | 2 +- src/macros.py | 2 +- src/mark-compact.cc | 340 ++--- src/mark-compact.h | 22 +- src/math.js | 2 +- src/memory.h | 2 +- src/messages.cc | 24 +- src/messages.h | 13 +- src/messages.js | 11 +- src/mirror-delay.js | 8 +- src/mksnapshot.cc | 6 +- src/natives.h | 2 +- src/objects-debug.cc | 2 +- src/objects-inl.h | 10 +- src/objects.cc | 103 +- src/objects.h | 78 +- src/parser.cc | 66 +- src/parser.h | 2 +- src/platform-linux.cc | 36 +- src/platform-macos.cc | 13 +- src/platform-nullos.cc | 2 +- src/platform-win32.cc | 14 +- src/platform.h | 4 +- src/prettyprinter.cc | 2 +- src/prettyprinter.h | 2 +- src/property.cc | 2 +- src/property.h | 4 +- src/regexp-delay.js | 2 +- src/rewriter.cc | 2 +- src/rewriter.h | 2 +- src/runtime.cc | 122 +- src/runtime.h | 7 +- src/runtime.js | 40 +- src/scanner.cc | 2 +- src/scanner.h | 2 +- src/scopeinfo.cc | 2 +- src/scopeinfo.h | 2 +- src/scopes.cc | 2 +- src/scopes.h | 2 +- src/serialize.cc | 175 ++- src/serialize.h | 9 +- src/shell.h | 2 +- src/simulator-arm.cc | 2 +- src/simulator-arm.h | 2 +- src/simulator-ia32.cc | 2 +- src/simulator-ia32.h | 2 +- src/smart-pointer.h | 2 +- src/snapshot-common.cc | 2 +- src/snapshot-empty.cc | 2 +- src/snapshot.h | 6 +- src/spaces-inl.h | 29 +- src/spaces.cc | 68 +- src/spaces.h | 124 +- src/string-stream.cc | 2 +- src/string-stream.h | 2 +- src/string.js | 2 +- src/stub-cache-arm.cc | 2 +- src/stub-cache-ia32.cc | 2 +- src/stub-cache.cc | 2 +- src/stub-cache.h | 2 +- src/token.cc | 2 +- src/token.h | 2 +- src/top.cc | 79 +- src/top.h | 6 +- src/unicode-inl.h | 2 +- src/unicode.cc | 36 +- src/unicode.h | 2 +- src/uri.js | 2 +- src/usage-analyzer.cc | 2 +- src/usage-analyzer.h | 2 +- src/utils.cc | 4 +- src/utils.h | 2 +- src/v8-counters.cc | 2 +- src/v8-counters.h | 4 +- src/v8.cc | 2 +- src/v8.h | 2 +- src/v8natives.js | 2 +- src/v8threads.cc | 16 +- src/v8threads.h | 2 +- src/variables.cc | 2 +- src/variables.h | 2 +- src/zone-inl.h | 2 +- src/zone.cc | 2 +- src/zone.h | 2 +- test/cctest/SConscript | 4 +- test/cctest/cctest.cc | 57 +- test/cctest/cctest.h | 16 +- test/cctest/cctest.status | 2 +- test/cctest/test-api.cc | 112 +- test/cctest/test-assembler-arm.cc | 2 +- test/cctest/test-assembler-ia32.cc | 2 +- test/cctest/test-ast.cc | 2 +- test/cctest/test-compiler.cc | 2 +- test/cctest/test-conversions.cc | 2 +- test/cctest/test-debug.cc | 21 +- test/cctest/test-decls.cc | 2 +- test/cctest/test-disasm-arm.cc | 2 +- test/cctest/test-disasm-ia32.cc | 2 +- test/cctest/test-flags.cc | 2 +- test/cctest/test-hashmap.cc | 2 +- test/cctest/test-heap.cc | 15 +- test/cctest/test-lock.cc | 2 +- test/cctest/test-mark-compact.cc | 26 +- test/cctest/test-platform-linux.cc | 2 +- test/cctest/test-platform-macos.cc | 2 +- test/cctest/test-platform-nullos.cc | 2 +- test/cctest/test-platform-win32.cc | 2 +- test/cctest/test-serialize.cc | 6 +- test/cctest/test-spaces.cc | 13 +- test/cctest/test-strings.cc | 43 +- test/cctest/test-utils.cc | 2 +- test/cctest/testcfg.py | 2 +- test/mjsunit/apply.js | 2 +- test/mjsunit/arguments-call-apply.js | 2 +- test/mjsunit/arguments-enum.js | 2 +- test/mjsunit/arguments-indirect.js | 2 +- test/mjsunit/arguments-opt.js | 2 +- test/mjsunit/arguments.js | 2 +- test/mjsunit/array-concat.js | 2 +- test/mjsunit/array-functions-prototype.js | 2 +- test/mjsunit/array-indexing.js | 2 +- test/mjsunit/array-iteration.js | 2 +- test/mjsunit/array-join.js | 2 +- test/mjsunit/array-length.js | 2 +- test/mjsunit/array-sort.js | 20 +- test/mjsunit/array-splice-webkit.js | 2 +- test/mjsunit/array-splice.js | 2 +- test/mjsunit/array_length.js | 2 +- test/mjsunit/ascii-regexp-subject.js | 2 +- test/mjsunit/binary-operation-overwrite.js | 2 +- test/mjsunit/body-not-visible.js | 2 +- test/mjsunit/bugs/bug-1231206.js | 2 +- test/mjsunit/bugs/bug-1344252.js | 2 +- test/mjsunit/bugs/bug-900066.js | 2 +- test/mjsunit/bugs/bug-941049.js | 2 +- test/mjsunit/call-non-function-call.js | 2 +- test/mjsunit/call-non-function.js | 2 +- test/mjsunit/call.js | 2 +- test/mjsunit/char-escape.js | 2 +- test/mjsunit/class-of-builtins.js | 2 +- test/mjsunit/closure.js | 2 +- test/mjsunit/compare-nan.js | 2 +- test/mjsunit/const-redecl.js | 2 +- test/mjsunit/const.js | 2 +- test/mjsunit/context-variable-assignments.js | 2 +- test/mjsunit/cyclic-array-to-string.js | 2 +- test/mjsunit/date-parse.js | 2 +- test/mjsunit/date.js | 2 +- test/mjsunit/debug-backtrace-text.js | 2 +- test/mjsunit/debug-backtrace.js | 2 +- test/mjsunit/debug-breakpoints.js | 2 +- test/mjsunit/debug-changebreakpoint.js | 2 +- test/mjsunit/debug-clearbreakpoint.js | 2 +- test/mjsunit/debug-conditional-breakpoints.js | 2 +- test/mjsunit/debug-constructed-by.js | 2 +- test/mjsunit/debug-constructor.js | 2 +- test/mjsunit/debug-continue.js | 2 +- .../debug-enable-disable-breakpoints.js | 2 +- test/mjsunit/debug-evaluate-arguments.js | 2 +- test/mjsunit/debug-evaluate-locals.js | 2 +- test/mjsunit/debug-evaluate-recursive.js | 2 +- test/mjsunit/debug-evaluate-with.js | 2 +- test/mjsunit/debug-evaluate.js | 2 +- test/mjsunit/debug-event-listener.js | 2 +- test/mjsunit/debug-ignore-breakpoints.js | 2 +- test/mjsunit/debug-multiple-breakpoints.js | 2 +- test/mjsunit/debug-referenced-by.js | 2 +- test/mjsunit/debug-script-breakpoints.js | 2 +- test/mjsunit/debug-script.js | 11 +- test/mjsunit/debug-scripts-request.js | 2 +- test/mjsunit/debug-setbreakpoint.js | 2 +- test/mjsunit/debug-sourceinfo.js | 4 +- test/mjsunit/debug-sourceslice.js | 2 +- test/mjsunit/debug-step-stub-callfunction.js | 2 +- test/mjsunit/debug-step.js | 2 +- test/mjsunit/debug-stepin-constructor.js | 2 +- test/mjsunit/declare-locally.js | 2 +- test/mjsunit/deep-recursion.js | 2 +- test/mjsunit/delay-syntax-error.js | 2 +- test/mjsunit/delete-global-properties.js | 2 +- test/mjsunit/delete-in-eval.js | 2 +- test/mjsunit/delete-in-with.js | 2 +- test/mjsunit/delete-vars-from-eval.js | 2 +- test/mjsunit/delete.js | 2 +- test/mjsunit/do-not-strip-fc.js | 2 +- test/mjsunit/dont-enum-array-holes.js | 2 +- test/mjsunit/dont-reinit-global-var.js | 2 +- test/mjsunit/double-equals.js | 2 +- test/mjsunit/dtoa.js | 2 +- test/mjsunit/enumeration_order.js | 2 +- test/mjsunit/escape.js | 2 +- test/mjsunit/eval-typeof-non-existing.js | 2 +- test/mjsunit/execScript-case-insensitive.js | 2 +- test/mjsunit/extra-arguments.js | 2 +- test/mjsunit/extra-commas.js | 2 +- test/mjsunit/for-in-null-or-undefined.js | 2 +- test/mjsunit/for-in-special-cases.js | 2 +- test/mjsunit/for-in.js | 19 +- test/mjsunit/fun-as-prototype.js | 2 +- test/mjsunit/fun_name.js | 2 +- test/mjsunit/function-arguments-null.js | 2 +- test/mjsunit/function-caller.js | 2 +- test/mjsunit/function-property.js | 2 +- test/mjsunit/function-prototype.js | 2 +- test/mjsunit/function-source.js | 2 +- test/mjsunit/function.js | 2 +- test/mjsunit/fuzz-accessors.js | 2 +- test/mjsunit/fuzz-natives.js | 2 +- test/mjsunit/getter-in-value-prototype.js | 2 +- test/mjsunit/global-const-var-conflicts.js | 2 +- test/mjsunit/global-vars-eval.js | 2 +- test/mjsunit/global-vars-with.js | 2 +- test/mjsunit/greedy.js | 2 +- test/mjsunit/has-own-property.js | 2 +- test/mjsunit/html-comments.js | 2 +- test/mjsunit/html-string-funcs.js | 2 +- test/mjsunit/if-in-undefined.js | 2 +- test/mjsunit/in.js | 2 +- test/mjsunit/instanceof.js | 2 +- test/mjsunit/integer-to-string.js | 2 +- test/mjsunit/invalid-lhs.js | 2 +- test/mjsunit/keyed-ic.js | 2 +- test/mjsunit/large-object-literal.js | 2 +- test/mjsunit/lazy-load.js | 2 +- test/mjsunit/leakcheck.js | 2 +- test/mjsunit/length.js | 2 +- test/mjsunit/math-min-max.js | 2 +- test/mjsunit/megamorphic-callbacks.js | 2 +- test/mjsunit/mirror-array.js | 2 +- test/mjsunit/mirror-boolean.js | 2 +- test/mjsunit/mirror-date.js | 2 +- test/mjsunit/mirror-error.js | 2 +- test/mjsunit/mirror-function.js | 2 +- test/mjsunit/mirror-null.js | 2 +- test/mjsunit/mirror-number.js | 2 +- test/mjsunit/mirror-object.js | 2 +- test/mjsunit/mirror-regexp.js | 2 +- test/mjsunit/mirror-string.js | 2 +- test/mjsunit/mirror-undefined.js | 2 +- test/mjsunit/mirror-unresolved-function.js | 2 +- test/mjsunit/mjsunit.js | 2 +- test/mjsunit/mjsunit.status | 11 +- test/mjsunit/mul-exhaustive.js | 2 +- test/mjsunit/negate-zero.js | 2 +- test/mjsunit/negate.js | 2 +- .../nested-repetition-count-overflow.js | 2 +- test/mjsunit/new.js | 2 +- test/mjsunit/newline-in-string.js | 2 +- test/mjsunit/no-branch-elimination.js | 2 +- test/mjsunit/no-octal-constants-above-256.js | 2 +- test/mjsunit/no-semicolon.js | 2 +- test/mjsunit/non-ascii-replace.js | 2 +- test/mjsunit/nul-characters.js | 2 +- test/mjsunit/number-limits.js | 2 +- test/mjsunit/number-string-index-call.js | 32 + test/mjsunit/number-tostring-small.js | 2 +- test/mjsunit/number-tostring.js | 2 +- test/mjsunit/obj-construct.js | 2 +- test/mjsunit/parse-int-float.js | 2 +- test/mjsunit/property-object-key.js | 2 +- test/mjsunit/proto.js | 2 +- test/mjsunit/prototype.js | 2 +- test/mjsunit/regexp-multiline-stack-trace.js | 2 +- test/mjsunit/regexp-multiline.js | 2 +- test/mjsunit/regexp-standalones.js | 2 +- test/mjsunit/regexp-static.js | 2 +- test/mjsunit/regexp.js | 2 +- test/mjsunit/regress/regress-1030466.js | 2 +- test/mjsunit/regress/regress-1036894.js | 2 +- test/mjsunit/regress/regress-1039610.js | 2 +- test/mjsunit/regress/regress-1050043.js | 2 +- test/mjsunit/regress/regress-1062422.js | 2 +- test/mjsunit/regress/regress-1066899.js | 2 +- test/mjsunit/regress/regress-1081309.js | 2 +- test/mjsunit/regress/regress-1102760.js | 2 +- test/mjsunit/regress/regress-1110164.js | 2 +- test/mjsunit/regress/regress-1112051.js | 2 +- test/mjsunit/regress/regress-1114040.js | 2 +- test/mjsunit/regress/regress-1134697.js | 2 +- test/mjsunit/regress/regress-1170187.js | 2 +- test/mjsunit/regress/regress-1173979.js | 2 +- test/mjsunit/regress/regress-1175390.js | 2 +- test/mjsunit/regress/regress-1177518.js | 2 +- test/mjsunit/regress/regress-1177809.js | 2 +- test/mjsunit/regress/regress-1178598.js | 2 +- test/mjsunit/regress/regress-1182832.js | 2 +- test/mjsunit/regress/regress-1187524.js | 2 +- test/mjsunit/regress/regress-1199401.js | 2 +- test/mjsunit/regress/regress-1199637.js | 2 +- test/mjsunit/regress/regress-1200351.js | 993 ++++++++------- test/mjsunit/regress/regress-1201933.js | 2 +- test/mjsunit/regress/regress-1203459.js | 2 +- test/mjsunit/regress/regress-1207276.js | 2 +- test/mjsunit/regress/regress-1213516.js | 2 +- test/mjsunit/regress/regress-1213575.js | 2 +- test/mjsunit/regress/regress-1215653.js | 2 +- test/mjsunit/regress/regress-1254366.js | 2 +- test/mjsunit/regress/regress-1327557.js | 2 +- test/mjsunit/regress/regress-1341167.js | 2 +- .../regress-1346700.js} | 2 +- test/mjsunit/regress/regress-20070207.js | 2 +- test/mjsunit/regress/regress-35.js | 33 + test/mjsunit/regress/regress-57.js | 32 + test/mjsunit/regress/regress-588599.js | 2 +- test/mjsunit/regress/regress-662254.js | 2 +- test/mjsunit/regress/regress-666721.js | 2 +- test/mjsunit/regress/regress-667061.js | 2 +- test/mjsunit/regress/regress-670147.js | 2 +- test/mjsunit/regress/regress-674753.js | 2 +- test/mjsunit/regress/regress-676025.js | 2 +- test/mjsunit/regress/regress-678525.js | 2 +- test/mjsunit/regress/regress-682649.js | 2 +- test/mjsunit/regress/regress-734862.js | 2 +- test/mjsunit/regress/regress-737588.js | 2 +- test/mjsunit/regress/regress-780423.js | 2 +- test/mjsunit/regress/regress-799761.js | 2 +- test/mjsunit/regress/regress-806473.js | 2 +- test/mjsunit/regress/regress-842017.js | 2 +- test/mjsunit/regress/regress-874178.js | 2 +- test/mjsunit/regress/regress-875031.js | 2 +- test/mjsunit/regress/regress-877615.js | 2 +- test/mjsunit/regress/regress-892742.js | 2 +- test/mjsunit/regress/regress-900055.js | 2 +- test/mjsunit/regress/regress-900966.js | 2 +- test/mjsunit/regress/regress-925537.js | 2 +- test/mjsunit/regress/regress-937896.js | 2 +- test/mjsunit/regress/regress-990205.js | 2 +- test/mjsunit/regress/regress-992733.js | 2 +- test/mjsunit/regress/regress-996542.js | 2 +- test/mjsunit/regress/regress-998565.js | 2 +- test/mjsunit/scanner.js | 2 +- test/mjsunit/smi-negative-zero.js | 2 +- test/mjsunit/smi-ops.js | 2 +- test/mjsunit/sparse-array-reverse.js | 2 +- test/mjsunit/sparse-array.js | 2 +- test/mjsunit/str-to-num.js | 2 +- test/mjsunit/stress-array-push.js | 2 +- test/mjsunit/strict-equals.js | 2 +- test/mjsunit/string-case.js | 2 +- test/mjsunit/string-charat.js | 2 +- test/mjsunit/string-charcodeat.js | 2 +- test/mjsunit/string-flatten.js | 2 +- test/mjsunit/string-index.js | 2 +- test/mjsunit/string-indexof.js | 2 +- test/mjsunit/string-lastindexof.js | 2 +- test/mjsunit/string-localecompare.js | 2 +- test/mjsunit/string-search.js | 2 +- test/mjsunit/string-split.js | 2 +- test/mjsunit/substr.js | 2 +- test/mjsunit/testcfg.py | 5 +- test/mjsunit/this-in-callbacks.js | 2 +- test/mjsunit/this.js | 2 +- .../throw-exception-for-null-access.js | 2 +- test/mjsunit/to-precision.js | 2 +- test/mjsunit/tobool.js | 2 +- test/mjsunit/toint32.js | 2 +- test/mjsunit/touint32.js | 2 +- test/mjsunit/try-finally-nested.js | 2 +- test/mjsunit/try.js | 2 +- test/mjsunit/try_catch_scopes.js | 2 +- test/mjsunit/unicode-string-to-number.js | 2 +- test/mjsunit/unicode-test.js | 2 +- test/mjsunit/unusual-constructor.js | 2 +- test/mjsunit/uri.js | 2 +- test/mjsunit/value-callic-prototype-change.js | 2 +- test/mjsunit/var.js | 2 +- test/mjsunit/with-leave.js | 2 +- test/mjsunit/with-parameter-access.js | 2 +- test/mjsunit/with-value.js | 2 +- test/mozilla/mozilla.status | 7 +- test/mozilla/testcfg.py | 5 +- tools/js2c.py | 2 +- tools/linux-tick-processor.py | 2 +- tools/presubmit.py | 44 +- tools/splaytree.py | 2 +- tools/test.py | 41 +- tools/tickprocessor.py | 2 +- tools/utils.py | 2 +- tools/v8.xcodeproj/project.pbxproj | 1128 +++++++++++++++++ tools/visual_studio/v8.vcproj | 4 +- tools/windows-tick-processor.py | 2 +- 498 files changed, 4328 insertions(+), 1860 deletions(-) create mode 100644 AUTHORS create mode 100644 codereview.settings create mode 100644 test/mjsunit/number-string-index-call.js rename test/mjsunit/{bugs/bug-1346700.js => regress/regress-1346700.js} (95%) create mode 100644 test/mjsunit/regress/regress-35.js create mode 100644 test/mjsunit/regress/regress-57.js create mode 100644 tools/v8.xcodeproj/project.pbxproj diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 000000000000..7bdd7f775278 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,11 @@ +# Below is a list of people and organizations that have contributed +# to the V8 project. Names should be added to the list like so: +# +# Name/Organization + +Google Inc. + +Rene Rebe +Rafal Krypa +Jay Freeman +Daniel James diff --git a/ChangeLog b/ChangeLog index b93a44ce92cd..33cfd0b886f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,48 @@ +2008-09-11: Version 0.3.1 + + Fixed a number of build issues. + + Fixed problem with missing I-cache flusing on ARM. + + Changed space layout in memory management by splitting up + code space into old data space and code space. + + Added utf-8 conversion support to the API (issue 57). + + Optimized repeated calls to eval with the same strings. These + repeated calls are common in web applications. + + Added Xcode project file. + + Optimized a couple of Array operation. + + Fixed parser bug by checking for end-of-string when parsing break + and continue (issue 35). + + Fixed problem where asian characters were not categorized as + letters. + + Fixed bug that disallowed calling functions fetched from an array + using a string as an array index (issue 32). + + Fixed bug where the internal field count on object templates were + sometimes ignored (issue 54). + + Added -f option to the shell sample for compatibility with other + engines (issue 18). + + Added source info to TryCatches in the API. + + Fixed problem where the seed for the random number generator was + clipped in a double to unsigned int conversion. + + Fixed bug where cons string symbols were sometimes converted to + non-symbol flat strings during GC. + + Fixed bug in error reporting when attempting to convert null to an + object. + + 2008-09-04: Version 0.3.0 Added support for running tests on the ARM simulator. diff --git a/SConstruct b/SConstruct index 34f20d340ac7..a2bed5652c1c 100644 --- a/SConstruct +++ b/SConstruct @@ -1,4 +1,4 @@ -# Copyright 2008 Google Inc. All rights reserved. +# Copyright 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: @@ -30,6 +30,7 @@ import re import sys import os from os.path import join, dirname, abspath +from types import DictType root_dir = dirname(File('SConstruct').rfile().abspath) sys.path.append(join(root_dir, 'tools')) import js2c, utils @@ -55,8 +56,9 @@ LIBRARY_FLAGS = { 'CCFLAGS': ['-O2'] }, 'wordsize:64': { - 'CCFLAGS': ['-m32'] - }, + 'CCFLAGS': ['-m32'], + 'LINKFLAGS': ['-m32'] + } }, 'msvc': { 'all': { @@ -95,6 +97,9 @@ V8_EXTRA_FLAGS = { 'arch:arm': { 'CPPDEFINES': ['ARM'] }, + 'disassembler:on': { + 'CPPDEFINES': ['ENABLE_DISASSEMBLER'] + } }, 'msvc': { 'all': { @@ -106,6 +111,9 @@ V8_EXTRA_FLAGS = { 'arch:arm': { 'CPPDEFINES': ['ARM'] }, + 'disassembler:on': { + 'CPPDEFINES': ['ENABLE_DISASSEMBLER'] + } } } @@ -182,6 +190,9 @@ SAMPLE_FLAGS = { 'CCFLAGS': ['-m32'], 'LINKFLAGS': ['-m32'] }, + 'mode:debug': { + 'CCFLAGS': ['-g', '-O0'] + } }, 'msvc': { 'all': { @@ -281,6 +292,16 @@ SIMPLE_OPTIONS = { 'values': ['arm', 'none'], 'default': 'none', 'help': 'build with simulator' + }, + 'disassembler': { + 'values': ['on', 'off'], + 'default': 'off', + 'help': 'enable the disassembler to inspect generated code' + }, + 'sourcesignatures': { + 'values': ['MD5', 'timestamp'], + 'default': 'MD5', + 'help': 'set how the build system detects file changes' } } @@ -369,6 +390,14 @@ class BuildContext(object): else: return env.SharedObject(input, **kw) + def ApplyEnvOverrides(self, env): + if not self.env_overrides: + return + if type(env['ENV']) == DictType: + env['ENV'].update(**self.env_overrides) + else: + env['ENV'] = self.env_overrides + def PostprocessOptions(options): # Adjust architecture if the simulator option has been set @@ -427,6 +456,7 @@ def BuildSpecific(env, mode, env_overrides): ) # Link the object files into a library. + context.ApplyEnvOverrides(env) if context.options['library'] == 'static': library = env.StaticLibrary(library_name, object_files) else: @@ -440,7 +470,7 @@ def BuildSpecific(env, mode, env_overrides): for sample in context.samples: sample_env = Environment(LIBRARY=library_name) sample_env.Replace(**context.flags['sample']) - sample_env['ENV'].update(**context.env_overrides) + context.ApplyEnvOverrides(sample_env) sample_object = sample_env.SConscript( join('samples', 'SConscript'), build_dir=join('obj', 'sample', sample, target_id), @@ -470,6 +500,8 @@ def Build(): VerifyOptions(env) env_overrides = ParseEnvOverrides(env['env']) + SourceSignatures(env['sourcesignatures']) + libraries = [] cctests = [] samples = [] diff --git a/benchmarks/base.js b/benchmarks/base.js index d3c9dcaec982..55e717d868c9 100644 --- a/benchmarks/base.js +++ b/benchmarks/base.js @@ -1,4 +1,4 @@ -// Copyright 2008 Google Inc. All Rights Reserved. +// Copyright 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: diff --git a/benchmarks/deltablue.js b/benchmarks/deltablue.js index b18efa4306da..b51afd1d2dea 100644 --- a/benchmarks/deltablue.js +++ b/benchmarks/deltablue.js @@ -1,4 +1,4 @@ -// Copyright 2008 Google Inc. All Rights Reserved. +// Copyright 2008 the V8 project authors. All rights reserved. // Copyright 1996 John Maloney and Mario Wolczko. // This program is free software; you can redistribute it and/or modify diff --git a/benchmarks/richards.js b/benchmarks/richards.js index 8cced90bd097..7df363d9803e 100644 --- a/benchmarks/richards.js +++ b/benchmarks/richards.js @@ -1,4 +1,4 @@ -// Copyright 2007 Google Inc. 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: diff --git a/benchmarks/run.js b/benchmarks/run.js index 8302535d411b..7a1c89584a20 100644 --- a/benchmarks/run.js +++ b/benchmarks/run.js @@ -1,4 +1,4 @@ -// Copyright 2008 Google Inc. All Rights Reserved. +// Copyright 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: diff --git a/codereview.settings b/codereview.settings new file mode 100644 index 000000000000..e83396c25d5f --- /dev/null +++ b/codereview.settings @@ -0,0 +1,4 @@ +# This file is used by gcl to get repository specific information. +CODE_REVIEW_SERVER: codereview.chromium.org +VIEW_VC: http://code.google.com/p/v8/source/detail?r= +CC_LIST: v8-dev@googlegroups.com diff --git a/include/v8-debug.h b/include/v8-debug.h index 8881e4a2965c..f537d7dc891f 100644 --- a/include/v8-debug.h +++ b/include/v8-debug.h @@ -1,4 +1,4 @@ -// Copyright 2008 Google Inc. All Rights Reserved. +// Copyright 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: @@ -25,8 +25,8 @@ // (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_DEBUG -#define _V8_DEBUG +#ifndef V8_DEBUG_H_ +#define V8_DEBUG_H_ #include "v8.h" @@ -140,4 +140,4 @@ class EXPORT Debug { #undef EXPORT -#endif // _V8_DEBUG +#endif // V8_DEBUG_H_ diff --git a/include/v8.h b/include/v8.h index ddd423e0e4a9..fd6d9ab2783e 100644 --- a/include/v8.h +++ b/include/v8.h @@ -1,4 +1,4 @@ -// Copyright 2007-2008 Google Inc. All Rights Reserved. +// Copyright 2007-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: @@ -26,8 +26,8 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** \mainpage V8 API Reference Guide - * - * V8 is Google's open source JavaScript engine. + * + * V8 is Google's open source JavaScript engine. * * This set of documents provides reference material generated from the * V8 header file, include/v8.h. @@ -35,8 +35,8 @@ * For other documentation see http://code.google.com/apis/v8/ */ -#ifndef _V8 -#define _V8 +#ifndef V8_H_ +#define V8_H_ #include @@ -461,10 +461,8 @@ class EXPORT HandleScope { /** Deallocates any extensions used by the current scope.*/ static void DeleteExtensions(); -#ifdef DEBUG // Zaps the handles in the half-open interval [start, end). static void ZapRange(void** start, void** end); -#endif friend class ImplementationUtilities; }; @@ -485,7 +483,7 @@ class EXPORT Data { /** * Pre-compilation data that can be associated with a script. This * data can be calculated for a script in advance of actually - * compiling it, and can bestored between compilations. When script + * compiling it, and can be stored between compilations. When script * data is given to the compile method compilation will be faster. */ class EXPORT ScriptData { // NOLINT @@ -555,7 +553,7 @@ class EXPORT Script { class EXPORT Message { public: Local Get(); - Local GetSourceLine(); + Local GetSourceLine(); // TODO(1241256): Rewrite (or remove) this method. We don't want to // deal with ownership of the returned string and we want to use @@ -568,8 +566,35 @@ class EXPORT Message { // bindings. Handle GetSourceData(); + /** + * Returns the number, 1-based, of the line where the error occurred. + */ int GetLineNumber(); + /** + * Returns the index within the script of the first character where + * the error occurred. + */ + int GetStartPosition(); + + /** + * Returns the index within the script of the last character where + * the error occurred. + */ + int GetEndPosition(); + + /** + * Returns the index within the line of the first character where + * the error occurred. + */ + int GetStartColumn(); + + /** + * Returns the index within the line of the last character where + * the error occurred. + */ + int GetEndColumn(); + // TODO(1245381): Print to a string instead of on a FILE. static void PrintCurrentStackTrace(FILE* out); }; @@ -631,7 +656,7 @@ class EXPORT Value : public Data { * Returns true if this value is boolean. */ bool IsBoolean(); - + /** * Returns true if this value is a number. */ @@ -696,8 +721,18 @@ class EXPORT Boolean : public Primitive { */ class EXPORT String : public Primitive { public: + + /** + * Returns the number of characters in this string. + */ int Length(); + /** + * Returns the number of bytes in the UTF-8 encoded + * representation of this string. + */ + int Utf8Length(); + /** * Write the contents of the string to an external buffer. * If no arguments are given, expects the buffer to be large @@ -716,9 +751,8 @@ class EXPORT String : public Primitive { * excluding the NULL terminator. */ int Write(uint16_t* buffer, int start = 0, int length = -1); // UTF-16 - int WriteAscii(char* buffer, - int start = 0, - int length = -1); // literally ascii + int WriteAscii(char* buffer, int start = 0, int length = -1); // ASCII + int WriteUtf8(char* buffer, int length = -1); // UTF-8 /** * Returns true if the string is external @@ -733,7 +767,7 @@ class EXPORT String : public Primitive { * An ExternalStringResource is a wrapper around a two-byte string * buffer that resides outside V8's heap. Implement an * ExternalStringResource to manage the life cycle of the underlying - * buffer. + * buffer. Note that the string data must be immutable. */ class EXPORT ExternalStringResource { // NOLINT public: @@ -757,7 +791,11 @@ class EXPORT String : public Primitive { * An ExternalAsciiStringResource is a wrapper around an ascii * string buffer that resides outside V8's heap. Implement an * ExternalAsciiStringResource to manage the life cycle of the - * underlying buffer. + * underlying buffer. Note that the string data must be immutable + * and that the data must be strict 7-bit ASCII, not Latin1 or + * UTF-8, which would require special treatment internally in the + * engine and, in the case of UTF-8, do not allow efficient indexing. + * Use String::New or convert to 16 bit data for non-ASCII. */ class EXPORT ExternalAsciiStringResource { // NOLINT @@ -835,6 +873,21 @@ class EXPORT String : public Primitive { /** Creates an undetectable string from the supplied utf-16 data.*/ static Local NewUndetectable(const uint16_t* data, int length = -1); + /** + * Converts an object to a utf8-encoded character array. Useful if + * you want to print the object. + */ + class EXPORT Utf8Value { + public: + explicit Utf8Value(Handle obj); + ~Utf8Value(); + char* operator*() { return str_; } + int length() { return length_; } + private: + char* str_; + int length_; + }; + /** * Converts an object to an ascii string. * Useful if you want to print the object. @@ -844,8 +897,10 @@ class EXPORT String : public Primitive { explicit AsciiValue(Handle obj); ~AsciiValue(); char* operator*() { return str_; } + int length() { return length_; } private: char* str_; + int length_; }; /** @@ -856,8 +911,10 @@ class EXPORT String : public Primitive { explicit Value(Handle obj); ~Value(); uint16_t* operator*() { return str_; } + int length() { return length_; } private: uint16_t* str_; + int length_; }; }; @@ -1755,7 +1812,7 @@ class EXPORT V8 { static void IgnoreOutOfMemoryException(); /** - * Check if V8 is dead and therefore unusable. This is the case after + * Check if V8 is dead and therefore unusable. This is the case after * fatal errors such as out-of-memory situations. */ static bool IsDead(); @@ -1900,6 +1957,15 @@ class EXPORT TryCatch { */ Local Exception(); + /** + * Returns the message associated with this exception. If there is + * no message associated an empty handle is returned. + * + * The returned handle is valid until this TryCatch block has been + * destroyed. + */ + Local Message(); + /** * Clears any exceptions that may have been caught by this try/catch block. * After this method has been called, HasCaught() will return false. @@ -1921,10 +1987,19 @@ class EXPORT TryCatch { */ void SetVerbose(bool value); + /** + * Set whether or not this TryCatch should capture a Message object + * which holds source information about where the exception + * occurred. True by default. + */ + void SetCaptureMessage(bool value); + public: TryCatch* next_; void* exception_; + void* message_; bool is_verbose_; + bool capture_message_; }; @@ -2116,11 +2191,11 @@ class EXPORT Locker { */ static void StopPreemption(); -#ifdef DEBUG - static void AssertIsLocked(); -#else - static inline void AssertIsLocked() { } -#endif + /** + * Returns whether or not the locker is locked by the current thread. + */ + static bool IsLocked(); + private: bool has_lock_; bool top_level_; @@ -2302,4 +2377,4 @@ void Template::Set(const char* name, v8::Handle value) { #undef TYPE_CHECK -#endif // _V8 +#endif // V8_H_ diff --git a/samples/SConscript b/samples/SConscript index bab66418fcc4..31990b681be3 100644 --- a/samples/SConscript +++ b/samples/SConscript @@ -1,4 +1,4 @@ -# Copyright 2008 Google Inc. All rights reserved. +# Copyright 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: @@ -31,6 +31,7 @@ Import('sample context') def ConfigureObjectFiles(): env = Environment() env.Replace(**context.flags['sample']) + context.ApplyEnvOverrides(env) return env.Object(sample + '.cc') sample_object = ConfigureObjectFiles() diff --git a/samples/count-hosts.js b/samples/count-hosts.js index 5c714c3e03bd..bea6553d27bb 100644 --- a/samples/count-hosts.js +++ b/samples/count-hosts.js @@ -1,4 +1,4 @@ -// Copyright 2008 Google Inc. All Rights Reserved. +// Copyright 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: diff --git a/samples/process.cc b/samples/process.cc index c0710f323a27..6567f080b86a 100644 --- a/samples/process.cc +++ b/samples/process.cc @@ -1,4 +1,4 @@ -// Copyright 2008 Google Inc. All Rights Reserved. +// Copyright 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: @@ -137,7 +137,7 @@ static Handle LogCallback(const Arguments& args) { if (args.Length() < 1) return v8::Undefined(); HandleScope scope; Handle arg = args[0]; - String::AsciiValue value(arg); + String::Utf8Value value(arg); HttpRequestProcessor::Log(*value); return v8::Undefined(); } @@ -206,7 +206,7 @@ bool JsHttpRequestProcessor::ExecuteScript(Handle script) { // Compile the script and check for errors. Handle