GithubHelp home page GithubHelp logo

jerryscript-project / jerryscript Goto Github PK

View Code? Open in Web Editor NEW
6.8K 194.0 660.0 60.39 MB

Ultra-lightweight JavaScript engine for the Internet of Things.

Home Page: https://jerryscript.net

License: Apache License 2.0

CMake 0.98% C++ 0.10% C 70.59% Assembly 0.02% JavaScript 24.93% Makefile 0.08% Shell 0.53% Python 2.75% Batchfile 0.03%
javascript-engine javascript jerryscript internet-of-things iot runtime

jerryscript's Introduction

JerryScript: JavaScript engine for the Internet of Things

License GitHub Actions Status AppVeyor Build Status FOSSA Status IRC Channel

JerryScript is a lightweight JavaScript engine for resource-constrained devices such as microcontrollers. It can run on devices with less than 64 KB of RAM and less than 200 KB of flash memory.

Key characteristics of JerryScript:

  • Full ECMAScript 5.1 standard compliance
  • 160K binary size when compiled for ARM Thumb-2
  • Heavily optimized for low memory consumption
  • Written in C99 for maximum portability
  • Snapshot support for precompiling JavaScript source code to byte code
  • Mature C API, easy to embed in applications

Additional information can be found on our project page and Wiki.

Memory usage and Binary footprint are measured at here with real target daily.

The latest results on Raspberry Pi 2:

Remote Testrunner

IRC channel: #jerryscript on freenode Mailing list: [email protected], you can subscribe here and access the mailing list archive here.

Quick Start

Getting the sources

git clone https://github.com/jerryscript-project/jerryscript.git
cd jerryscript

Building JerryScript

python tools/build.py

For additional information see Getting Started.

Documentation

Contributing

The project can only accept contributions which are licensed under the Apache License 2.0 and are signed according to the JerryScript Developer's Certificate of Origin. For further information please see our Contribution Guidelines.

License

JerryScript is open source software under the Apache License 2.0. Complete license and copyright information can be found in the source code.

FOSSA Status

Copyright JS Foundation and other contributors, http://js.foundation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

jerryscript's People

Contributors

akosthekiss avatar bzsolt avatar dbatyai avatar egavrin avatar fbmrk avatar galpeter avatar janjongboom avatar jiangzidong avatar kkristof avatar ktorpi avatar laszlolango avatar lemmaa avatar lvidacs avatar lygstate avatar mmatyas avatar orkvi avatar ossy-szeged avatar pfalcon avatar robertsipka avatar rtakacs avatar ruben-ayrapetyan avatar rwalczyna avatar sand1k avatar seanshpark avatar szilagyiadam avatar szledan avatar wateret avatar yichoi avatar yuyupo avatar zherczeg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jerryscript's Issues

Enhance 'make log' info

  • Add test262 pass rate information
  • Provide binary size information for each configuration
  • Merge log information into tables:
peak parser consumption byte-code size peak runtime consumption (without bytecode) peak overall consumption rss
benchmark suite 1:
bench1.js
bench2.js
bench3.js
benchmark suite 2:
stm32 mem limit 8kb 32kb 64kb 128kb
benchmark suite 1:
bench1.js
bench2.js
bench3.js
benchmark suite 2:

Blocks: #56

Implement ECMA262 String builtin object

To track status of progress of String builtin.

See ECMA262 String for specification.

Required items

  • String()
  • new String()
  • String.prototype
  • String.fromCharCode
  • String.prototype.constructor
  • String.prototype.toString( )
  • String.prototype.valueOf( )
  • String.prototype.charAt() #320
  • String.prototype.charCodeAt() #352
  • String.prototype.concat() #159
  • String.prototype.indexOf() #456
  • String.prototype.lastIndexOf() #483
  • String.prototype.localeCompare() #386
  • String.prototype.match() #443
  • String.prototype.replace() #474
  • String.prototype.search() #504
  • String.prototype.slice() #138
  • String.prototype.split() #530
  • String.prototype.substring() #244 #318
  • String.prototype.toLowerCase() #365
  • String.prototype.toLocaleLowerCase() #365
  • String.prototype.toUpperCase() #365
  • String.prototype.toLocaleUpperCase() #365
  • String.prototype.trim() #191
  • length

disable assert implementation

'assert' function itself is not included in ECMA spec but is included in JerryScript, opcodes-dumper.cpp
programs embedding JerryScript will implement 'assert', including IoT.js.
need some compile time option to disable internal 'assert' and maybe others like 'print'

API for expanding Magic string

Jerry has magic string for strings that are commonly used so to save the heap, I think.
As for embedding Jerry, it would be useful to register magic strings with an API to save heap space,
for example IoT.js built-in scripts.

Support labelled statements

  • generate break and continue opcodes
  • break and continue completion values
  • determine if break / continue target is in current scope

Remove Severity mechanism from mem allocator

Currently, severity mechanism isn't really used, so consider removing it.

This will eliminate checks like the following:

  for (mem_try_give_memory_back_severity_t severity = MEM_TRY_GIVE_MEMORY_BACK_SEVERITY_LOW;
       severity <= MEM_TRY_GIVE_MEMORY_BACK_SEVERITY_CRITICAL;
       severity = (mem_try_give_memory_back_severity_t) (severity + 1))

Create JERRY_LOG macros

Currently the only way to print debug information is using 'fprintf' with JERRY_NDEBUG. It would be helpful to do some logger macros to wrap NDEBUG and fprintf at least. The possibility of setting different debug levels can make this more useful.

Example:
JERRY_DPRINT("This is a first level debug message!", variables);
JERRY_DDPRINT("This is a second level debug message!", variables);
JERRY_DDDPRINT("This is a third level debug message!", variables);

Add configuration option for disabling selected built-in objects.

To improve the configurability of the engine it's needed to provide build time flags for disabling selected built-ins.

Compact profile has possibility for this:

#ifdef CONFIG_ECMA_COMPACT_PROFILE
// #define CONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN
// #define CONFIG_ECMA_COMPACT_PROFILE_DISABLE_STRING_BUILTIN
// #define CONFIG_ECMA_COMPACT_PROFILE_DISABLE_BOOLEAN_BUILTIN
// #define CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS
// #define CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN
// #define CONFIG_ECMA_COMPACT_PROFILE_DISABLE_MATH_BUILTIN
// #define CONFIG_ECMA_COMPACT_PROFILE_DISABLE_DATE_BUILTIN
// #define CONFIG_ECMA_COMPACT_PROFILE_DISABLE_JSON_BUILTIN
// #define CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN
#endif /* CONFIG_ECMA_COMPACT_PROFILE */

//cc @seanshpark

Implement ECMA262 Number builtin object

Track the Number built in progress.
Related ECMA262 section: http://www.ecma-international.org/ecma-262/5.1/#sec-15.7

  • Number(..)
  • new Number(..)
  • Number.length
  • Number.MAX_VALUE
  • Number.MIN_VALUE
  • Number.NaN
  • Number.NEGATIVE_INFINITY
  • Number.POSITIVE_INFINITY
  • Number.prototype
  • Number.prototype.constructor
  • Number.prototype.toString(..) #306
  • Number.prototype.toLocaleString()
  • Number.prototype.valueOf()
  • Number.prototype.toFixed(..) #100
  • Number.prototype.toExponential(..) #224
  • Number.prototype.toPrecision(..) #238

Complete ECMA262 Math builtin object

Track the Math built in progress.
Related ECMA262 section: http://www.ecma-international.org/ecma-262/5.1/#sec-15.8

  • Math.E
  • Math.LN10
  • Math.LN2
  • Math.LOG2E
  • Math.LOG10E
  • Math.PI
  • Math.SQRT1_2
  • Math.SQRT2
  • Math.abs(..)
  • Math.acos(..)
  • Math.asin(..)
  • Math.atan(..)
  • Math.atan2(..)
  • Math.ceil(..)
  • Math.cos(..)
  • Math.exp(..)
  • Math.floor(..)
  • Math.log(..)
  • Math.max(..)
  • Math.min(..)
  • Math.pow(..)
  • Math.random()
  • Math.round(..)
  • Math.sin(..)
  • Math.sqrt(..)
  • Math.tan(..)

Implement ECMA262 Array builtin object.

JerryScript Engine support Array builtin object but very limited.
The relevant specification is ECMA262 15.4
We need to get it to be done.

Required method/properties:

  • Array(..)
  • new Array(..)
  • Array.prototype
  • Array.isArray(..)
  • Array.prototype.concat(..) #98
  • Array.prototype.every(..) #84
  • Array.prototype.filter(..) #89
  • Array.prototype.forEach(..) #39
  • Array.prototype.indexOf(..) #26
  • Array.prototype.join(..) #38
  • Array.prototype.lastIndexOf(..) #77
  • Array.prototype.map(..) #135
  • Array.prototype.pop(..) #22
  • Array.prototype.push(..) #7
  • Array.prototype.reduce(..) #104
  • Array.prototype.reduceRight(..) #105
  • Array.prototype.reverse(..) #90
  • Array.prototype.shift(..) #24
  • Array.prototype.slice(..) #78
  • Array.prototype.some(..) #85
  • Array.prototype.sort(..) #95
  • Array.prototype.splice(..) #86
  • Array.prototype.toLocaleString(..) #96
  • Array.prototype.toString(..) #36
  • Array.prototype.unshift(..) #25

Implement JSON object

  • Register the JSON built-in object.
  • parse()
    • implement a parser
    • implement a lexer
    • add support for reviver
  • stringify()
    • simple values to JSON
    • object values to JSON
    • array values to JSON
    • add support for replacer
    • add support for spaces (formatting)

merge request: #168

Style fix for Array builtin

The ordering should be fixed for Array.prototype functions. Additionally, small style fixes, like the issue from #90 should be addressed here as well.

Incorrect mcu script transformation

By using the tools/generator.sh we transform a js file to a JERRY_MCU_SCRIPT define. However there is a problem, take the following input mcu.js file:

var a = 2 * 2;

Executing the tools/generator.sh mcu.js output command will result the following content in the output file:

#define JERRY_MCU_SCRIPT \
"var a = 2 build CMakeLists.txt jerry-core jerry-libc LICENSE main-linux.cpp main-mcu.cpp main-nuttx.cpp Makefile mcu.js out plugins README.md tests third-party tools 2;\n" \

which clearly can't be used as a start js script.

Jerry API: throwing exception

It seems like there's no api for supporting exception handling in Jerry API.

We need exception handling api that facilitates following use case:

And below is probably less significant.

Implement ECMA262 Date builtin object

Related ECMA262 section: http://www.ecma-international.org/ecma-262/5.1/#sec-15.9

  • Date(..) #322
  • new Date(..) #322
  • Date.prototype
  • Date.parse(..) #297
  • Date.UTC(..) #305
  • Date.now() #305
  • Date.prototype.constructor
  • Date.prototype.toString() #336
  • Date.prototype.toDateString() #360
  • Date.prototype.toTimeString() #360
  • Date.prototype.toLocaleString() #416
  • Date.prototype.toLocaleDateString() #416
  • Date.prototype.toLocaleTimeString() #416
  • Date.prototype.valueOf()
  • Date.prototype.getTime() #334
  • Date.prototype.getFullYear() #334
  • Date.prototype.getUTCFullYear() #334
  • Date.prototype.getMonth() #334
  • Date.prototype.getUTCMonth() #334
  • Date.prototype.getDate() #334
  • Date.prototype.getUTCDate() #334
  • Date.prototype.getDay() #334
  • Date.prototype.getUTCDay() #334
  • Date.prototype.getHours() #334
  • Date.prototype.getUTCHours() #334
  • Date.prototype.getMinutes() #334
  • Date.prototype.getUTCMinutes() #334
  • Date.prototype.getSeconds() #334
  • Date.prototype.getUTCSeconds() #334
  • Date.prototype.getMilliseconds() #334
  • Date.prototype.getUTCMilliseconds() #334
  • Date.prototype.getTimezoneOffset() #334
  • Date.prototype.setTime(..) #367
  • Date.prototype.setMilliseconds(..) #367
  • Date.prototype.setUTCmilliseconds(..) #367
  • Date.prototype.setSeconds(..) #367
  • Date.prototype.setUTCSeconds(..) #367
  • Date.prototype.setMinutes(..) #367
  • Date.prototype.setUTCMinutes(..) #367
  • Date.prototype.setHours(..) #367
  • Date.prototype.setUTCHours(..) #367
  • Date.prototype.setDate(..) #367
  • Date.prototype.setUTCDate(..) #367
  • Date.prototype.setMonth(..) #367
  • Date.prototype.setUTCMonth(..) #367
  • Date.prototype.setFullYear(..) #367
  • Date.prototype.setUTCFullYear(..) #367
  • Date.prototype.toUTCString(..) #418
  • Date.prototype.toISOString() #418
  • Date.prototype.toJSON(..) #455

Merge eval_dev branch to master

'require' function in iotjs need eval feature which is not supported by current jerryscript/master branch. Thus, eval_dev should be merged into master.

prerequisites needs fix for behind firewalls

two changes are needed for behind firewalls

--- a/tools/prerequisites.sh
+++ b/tools/prerequisites.sh
@@ -211,7 +211,7 @@ function setup_vera() {
     return 0
   fi

-  wget -O "$TMP_DIR/$NAME.tar.gz" "$URL" || fail_msg "$FAIL_MSG. Cannot download '$URL' archive."
+  wget --no-check-certificate -O "$TMP_DIR/$NAME.tar.gz" "$URL" || fail_msg "$FAIL_MSG. Cannot download '$URL' archive."

   echo "$CHECKSUM $TMP_DIR/$NAME.tar.gz" | sha256sum --check --strict || fail_msg "$FAIL_MSG. Archive's checksum doesn't match."

@@ -246,7 +246,7 @@ setup_from_zip "stm32f4" \

 setup_nuttx_headers "nuttx" \
                      "./third-party/nuttx" \
-                     "git://git.code.sf.net/p/nuttx/git" \
+                     "http://git.code.sf.net/p/nuttx/git" \
                      "36a655eddec29754cc93631b6083fe6409817861"

 setup_cppcheck "cppcheck-1.66" \

Assertion 'property_p != NULL' failed in ecma_get_internal_property

Jerry version:
Checked revision: aaeec7f
Build: debug.linux
OS:
Ubuntu 14.04, x86_64
Test case:
Math.cos + 1;
Backtrace:
ICE: Assertion 'property_p != NULL' failed at jerryscript/jerry-core/ecma/base/ecma-helpers.cpp(ecma_get_internal_property):492.
Error: ERR_FAILED_INTERNAL_ASSERTION
[Inferior 1 (process 9984) exited with code 0170]
(gdb) bt
#0  ecma_get_internal_property (object_p=0x7e97f8 <_ZL13mem_heap_area.4015+184>, property_id=ECMA_INTERNAL_PROPERTY_CLASS)
    at jerryscript/jerry-core/ecma/base/ecma-helpers.cpp:492
#1  0x000000000046b807 in ecma_op_general_object_default_value (obj_p=0x7e97f8 <_ZL13mem_heap_area.4015+184>, hint=ECMA_PREFERRED_TYPE_NO)
    at jerryscript/jerry-core/ecma/operations/ecma-objects-general.cpp:507
#2  0x000000000047b0a1 in ecma_op_object_default_value (obj_p=0x7e97f8 <_ZL13mem_heap_area.4015+184>, hint=ECMA_PREFERRED_TYPE_NO)
    at jerryscript/jerry-core/ecma/operations/ecma-objects.cpp:404
#3  0x000000000046c9d4 in ecma_op_to_primitive (value=95, preferred_type=ECMA_PREFERRED_TYPE_NO)
    at jerryscript/jerry-core/ecma/operations/ecma-conversion.cpp:169
#4  0x00000000004ac9c8 in opfunc_addition (opdata=..., int_data=0x7fffffffd570)
    at jerryscript/jerry-core/vm/opcodes-ecma-arithmetics.cpp:117
#5  0x00000000004bfa60 in run_int_loop (int_data=0x7fffffffd570) at jerryscript/jerry-core/vm/vm.cpp:440
#6  0x00000000004b678d in run_int_from_pos (start_pos=0, this_binding_value=15, lex_env_p=0x7e9770 <_ZL13mem_heap_area.4015+48>, is_strict=false, 
    is_eval_code=false) at jerryscript/jerry-core/vm/vm.cpp:513
#7  0x00000000004bf82e in run_int () at jerryscript/jerry-core/vm/vm.cpp:381
#8  0x00000000004bd4d0 in jerry_run () at jerryscript/jerry-core/jerry.cpp:1243
#9  0x00000000004bbaff in main (argc=2, argv=0x7fffffffd918) at jerryscript/main-linux.cpp:248
CC: @ruben-ayrapetyan

Implement byte-code storage

  • byte-code and scopes allocator, based on generic dynamic storage
  • implement scope storage with hash table
  • implement pointer-based jumps

Blocks: #48

Implement ECMA262 RegExp builtin object and RegExp engine

Related ECMA2626 section: http://www.ecma-international.org/ecma-262/5.1/#sec-15.10.3

  • Regexp Builtin components
    • Register the RegExp built-in object.
    • RegExp(..)
      • RegExp(pattern)
      • RegExp(pattern, flag)
      • RegExp(RegExp)
    • new RegExp(..)
      • RegExp(pattern)
      • RegExp(pattern, flag)
      • RegExp(RegExp)
    • RegExp.prototype
    • RegExp.prototype.constructor
    • RegExp.prototype.exec(..)
    • RegExp.prototype.test(..)
    • RegExp.prototype.toString(..)
    • RegExp.source
    • RegExp.global
    • RegExp.ignoreCase
    • RegExp.multiline
    • RegExp.lastIndex
  • Implement RegExp bytecode storage
    • Requirements
      • Resize automatically when it is needed
      • Append and insert uint32 and uint8
      • Read uint32 and uint8
      • Advance in bytecode while reading
      • Dump container (for debug)
  • Compile RegExp bytecode
    • Compile RegExp pattern to an internal bytecode to be able to run it efficiently.
      • Disjunction
      • Alternative
      • Assertion
      • Atom
        • PatternCharacter
        • .
        • \ AtomEscape (depends on #49)
        • CharacterClass
      • Quantifier
  • Execute RegExp
    • Read the compiled bytecode and try to match.
      • Disjunction
      • Alternative
      • Assertion
      • Atom
        • PatternCharacter
        • .
        • \ AtomEscape
        • CharacterClass
      • Quantifier
      • Handle flags (depends on #49)
        • Global
        • IgnoreCase
        • Multiline
      • Set lastIndex property
      • Set properties of the returned array object
  • Parse RegularExpressionLiterals and create a RegExp object.

Unicode support

  • implement unicode handling in the string processing routines
  • unicode support in parser

Build failed using gcc-4.9.2

Build is failed on Ubuntu 15.04 with gcc-4.9.2:

/home/egavrin/dev/cj/jerryscript/jerry-core/mem/mem-heap.cpp:74:20: error: anonymous scoped enum is not allowed
 typedef enum class : uint8_t
                    ^
compilation terminated due to -Wfatal-errors.

Parser infinite loop on open brace

The js parser goes into an infinite loop if the input file contains this:

{

The engine loops in the preparse_scope (jerry-core/parser/js/parser.cpp) method.

Jerry API: free callback

Current version of jerry_api_set_object_free_callback() takes two parameter

  • pointer to object
  • function pointer to callback.

The prototype of callback is like this:

typedef void (*jerry_object_free_callback_t) (const uintptr_t native_p);

I think it's confusing that the callback takes native pointer as its parameter, since, at least i thought, there are no link connecting the native_p to something in this set of API.
Actually we need to set the native pointer using separate API named jerry_api_set_object_native_handle() to get it work. I think it's inconsistent. To make it consistent, I think, jerry_set_object_free_callback() should take one more parameter type of native pointer. or the callback function should take jerry_api_object_t* that is being destroyed and then we can access native pointer using jerry_api_get_object_native_handle().

Implement dynamic recordset

Dynamic recordset is a storage based on a chunked list, required to reduce fragmentation in case of frequent allocations / deallocations of big data blocks.

Blocks #45, #46.

Signed-off-by checker in precommit testing script

Hello.

We could add check for correctness of Signed-off-by tag into tools/precommit.sh.

For example, we could check, that the tag is placed at last line of commit message and is composed of exactly the following three parts, splitted by space character: common prefix, name and e-mail of the commit's author.

Question about mem_stats

Jerry build with -mem_stats shows heap usage information like below.

|-- Opcode: assignment (position 348) --
| Allocated heap bytes:  24076 -> 24076 (   +0, local     0, peak 52298)
|-- End of execution of opcode assignment (position 348) --

Question is, what does the second line numbers mean?
Current iotjs for nuttx has settings of heap size 60KB and at this point gets "out of memory error" and program terminates.

Assertion 'ecma_string_get_length (string_p) > ECMA_STRING_MAGIC_STRING_LENGTH_LIMIT || !ecma_is_string_magic_longpath failed in ecma_is_string_magic

Jerry version:
Checked revision: aaeec7f
Build: debug.linux
OS:
Ubuntu 14.04, x86_64
Test case:
v_1 = [];
v_1 * v_1[v_1 % v_1];
Backtrace:
ICE: Assertion 'ecma_string_get_length (string_p) > ECMA_STRING_MAGIC_STRING_LENGTH_LIMIT || !ecma_is_string_magic_longpath (string_p, out_id_p)' failed at jerryscript/jerry-core/ecma/base/ecma-helpers-string.cpp(ecma_is_string_magic):1698.
Error: ERR_FAILED_INTERNAL_ASSERTION
[Inferior 1 (process 11070) exited with code 0170]
(gdb) bt
#0  ecma_is_string_magic (string_p=0x7e9a80 <_ZL13mem_heap_area.4015+832>, out_id_p=0x7fffffffcfb8)
    at jerryscript/jerry-core/ecma/base/ecma-helpers-string.cpp:1697
#1  0x0000000000445127 in ecma_builtin_array_prototype_try_to_instantiate_property (obj_p=0x7e9798 <_ZL13mem_heap_area.4015+88>, 
    prop_name_p=0x7e9a80 <_ZL13mem_heap_area.4015+832>)
    at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-internal-routines-template.inc.h:112
#2  0x00000000004a82c9 in ecma_builtin_try_to_instantiate_property (object_p=0x7e9798 <_ZL13mem_heap_area.4015+88>, 
    string_p=0x7e9a80 <_ZL13mem_heap_area.4015+832>) at jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h:39
#3  0x000000000047aaf2 in ecma_op_object_get_own_property_longpath (obj_p=0x7e9798 <_ZL13mem_heap_area.4015+88>, 
    property_name_p=0x7e9a80 <_ZL13mem_heap_area.4015+832>) at jerryscript/jerry-core/ecma/operations/ecma-objects.cpp:156
#4  0x000000000047ad19 in ecma_op_object_get_own_property (obj_p=0x7e9798 <_ZL13mem_heap_area.4015+88>, 
    property_name_p=0x7e9a80 <_ZL13mem_heap_area.4015+832>) at jerryscript/jerry-core/ecma/operations/ecma-objects.cpp:188
#5  0x000000000046a72c in ecma_op_general_object_get_property (obj_p=0x7e9798 <_ZL13mem_heap_area.4015+88>, 
    property_name_p=0x7e9a80 <_ZL13mem_heap_area.4015+832>)
    at jerryscript/jerry-core/ecma/operations/ecma-objects-general.cpp:202
#6  0x000000000047adc4 in ecma_op_object_get_property (obj_p=0x7e9798 <_ZL13mem_heap_area.4015+88>, 
    property_name_p=0x7e9a80 <_ZL13mem_heap_area.4015+832>) at jerryscript/jerry-core/ecma/operations/ecma-objects.cpp:230
#7  0x000000000046a767 in ecma_op_general_object_get_property (obj_p=0x7e97b0 <_ZL13mem_heap_area.4015+112>, 
    property_name_p=0x7e9a80 <_ZL13mem_heap_area.4015+832>)
    at jerryscript/jerry-core/ecma/operations/ecma-objects-general.cpp:216
#8  0x000000000047adc4 in ecma_op_object_get_property (obj_p=0x7e97b0 <_ZL13mem_heap_area.4015+112>, 
    property_name_p=0x7e9a80 <_ZL13mem_heap_area.4015+832>) at jerryscript/jerry-core/ecma/operations/ecma-objects.cpp:230
#9  0x000000000046a23c in ecma_op_general_object_get (obj_p=0x7e97b0 <_ZL13mem_heap_area.4015+112>, 
    property_name_p=0x7e9a80 <_ZL13mem_heap_area.4015+832>)
    at jerryscript/jerry-core/ecma/operations/ecma-objects-general.cpp:126
#10 0x000000000047a9d5 in ecma_op_object_get (obj_p=0x7e97b0 <_ZL13mem_heap_area.4015+112>, property_name_p=0x7e9a80 <_ZL13mem_heap_area.4015+832>)
    at jerryscript/jerry-core/ecma/operations/ecma-objects.cpp:83
#11 0x000000000047b55e in ecma_op_get_value_object_base (ref=...)
    at jerryscript/jerry-core/ecma/operations/ecma-get-put-value.cpp:101
#12 0x0000000000452cd5 in opfunc_prop_getter (opdata=..., int_data=0x7fffffffd590) at jerryscript/jerry-core/vm/opcodes.cpp:1115
#13 0x00000000004bfa60 in run_int_loop (int_data=0x7fffffffd590) at jerryscript/jerry-core/vm/vm.cpp:440
#14 0x00000000004b678d in run_int_from_pos (start_pos=0, this_binding_value=15, lex_env_p=0x7e9770 <_ZL13mem_heap_area.4015+48>, is_strict=false, 
    is_eval_code=false) at jerryscript/jerry-core/vm/vm.cpp:513
#15 0x00000000004bf82e in run_int () at jerryscript/jerry-core/vm/vm.cpp:381
#16 0x00000000004bd4d0 in jerry_run () at jerryscript/jerry-core/jerry.cpp:1243
#17 0x00000000004bbaff in main (argc=2, argv=0x7fffffffd938) at jerryscript/main-linux.cpp:248

Complete ECMA262 Global object

Related ECMA262 section: http://www.ecma-international.org/ecma-262/5.1/#sec-15.1

Value properties of the Global object:

  • NaN
  • Infinity
  • undefined

Function properties of the Global object:

  • eval(..) #174
  • parseInt(..) #167
  • parseFloat(..) #190
  • isNaN(..)
  • isFinite(..)
  • decodeURI(..) #177
  • decodeURIComponent(..) #177
  • encodeURI(..) #177
  • encodeURIComponent(..) #177

Constuctor properties of the Global object:

  • Object(..) #34
  • Function(..) #93
  • Array(..) #3
  • String(..) #80
  • Boolean(..)
  • Number(..) #83
  • Date(..) #94
  • RegExp(..) #27
  • Error(..)
  • EvalError(..)
  • RangeError(..)
  • ReferenceError(..)
  • SyntaxError(..)
  • TypeError(..)
  • URIError(..)

Other properties of the Global object:

Assertion 'simple_value == ECMA_SIMPLE_VALUE_UNDEFINED || simple_value == ECMA_SIMPLE_VALUE_NULL || simple_value == ECMA_SIMPLE_VALUE_FALSE || simple_value == ECMA_SIMPLE_VALUE_TRUE' failed in ecma_make_simple_completion_value

Jerry version:
Checked revision: aaeec7f
Build: debug.linux
OS:
Ubuntu 14.04, x86_64
Test case:
v_1 = 1;
v_1[1] = 1;
Backtrace:
ICE: Assertion 'simple_value == ECMA_SIMPLE_VALUE_UNDEFINED || simple_value == ECMA_SIMPLE_VALUE_NULL || simple_value == ECMA_SIMPLE_VALUE_FALSE || simple_value == ECMA_SIMPLE_VALUE_TRUE' failed at jerryscript/jerry-core/ecma/base/ecma-helpers-value.cpp(ecma_make_simple_completion_value):597.
Error: ERR_FAILED_INTERNAL_ASSERTION
(gdb) bt
#0  ecma_make_simple_completion_value (simple_value=ECMA_SIMPLE_VALUE_EMPTY)
    at jerryscript/jerry-core/ecma/base/ecma-helpers-value.cpp:594
#1  ecma_reject_put (is_throw=false) at jerryscript/jerry-core/ecma/operations/ecma-get-put-value.cpp:192
#2  0x000000000047cd89 in ecma_op_put_value_object_base (ref=..., value=73)
    at jerryscript/jerry-core/ecma/operations/ecma-get-put-value.cpp:279
#3  0x0000000000454062 in opfunc_prop_setter (opdata=..., int_data=0x7fffffffd590) at jerryscript/jerry-core/vm/opcodes.cpp:1171
#4  0x00000000004bfa60 in run_int_loop (int_data=0x7fffffffd590) at jerryscript/jerry-core/vm/vm.cpp:440
#5  0x00000000004b678d in run_int_from_pos (start_pos=0, this_binding_value=15, lex_env_p=0x7e9770 <_ZL13mem_heap_area.4015+48>, is_strict=false, 
    is_eval_code=false) at jerryscript/jerry-core/vm/vm.cpp:513
#6  0x00000000004bf82e in run_int () at jerryscript/jerry-core/vm/vm.cpp:381
#7  0x00000000004bd4d0 in jerry_run () at jerryscript/jerry-core/jerry.cpp:1243
#8  0x00000000004bbaff in main (argc=2, argv=0x7fffffffd938) at jerryscript/main-linux.cpp:248

Make flags in prerequisites setup script

Hello.

Currently, prerequisites.sh uses 'make -j' to build cppcheck and vera++.
This can be too resource consuming.

To give control about the make options, we can pass "-j" flag in make command line only if it is passed to make instance, calling the script (MAKEFLAGS environment variable, created by make, can be used for this).

Implement literal storage

  • implement rcs_record_iterator_t (see rcs-recordset.h),
    extending test_recordset unit test to check the iterator;
  • create component (lit ?);
  • create record classes based on rcs_record_t for each literal type;
  • create class (lit_storage_t ?) based on rcs_recordset_t,
    implementing alloc / free interfaces for each record type;
  • add literal-type specific interfaces to record classes for receiving actual literal value
    (maybe temporary, just interface for getting length and character buffers?);
  • implement interfaces for literal construction, conversion, comparison, concatenation etc. (with unit tests?);
  • add some type similar to current literal_index_t for identifying literals, with related interfaces.
  • allocator, based on generic dynamic storage
  • move string processing routines to the component

Blocks: #48, #49, #50

Improve compiler detection

In some Linux systems the x86_64 compiler is not named x86_64-linux-gnu-gcc, but instead x86_64-unknown-linux-gnu-gcc. Related to this that it is also possible that there is no x86_64-linux-gnu-strip just the simple strip program.

Makefile support ARM linux

Hi,
I'm adding this issue as a todo item to support arm-linux and with maybe add other architecture-platform easier. And as there is no issue, I want to start with this not-urgent one.

  • platforms that we can support: linux, nuttx, darwin, ...
  • architectures: armv7, armv6, i686, x86_64, ...
  • type: debug, release, ...
  • mods: cp cp_minimal, mem_stats, ...
  • boards (maybe for embedded): stm32f3, stm32f4, ...

Add support of syntax error checking

  • implement setjmp / longjmp
  • add checks into parsing of expression
    • 11.1.5
    • 11.3.1
    • 11.3.2
    • 11.4.1
    • 11.4.4
    • 11.4.5
    • 11.13.1
    • 11.13.2
    • 12.2.1
    • 12.10.1
    • 12.14.1
    • 13.1

Implement ECMA262 Object builtin functions

Ecma 262 Objects reference http://www.ecma-international.org/ecma-262/5.1/#sec-15.2

Functions to implement:

  • Object(..)
  • new Object(..)
  • Object.create #209
  • Object.defineProperties #37
  • Object.defineProperty
  • Object.freeze #202
  • Object.getOwnPropertyDescriptor #81
  • Object.getOwnPropertyNames #124
  • Object.getPrototypeOf #151
  • Object.isExtensible #106
  • Object.isFrozen #202
  • Object.isSealed #172
  • Object.keys #124
  • Object.preventExtensions #106
  • Object.seal #172

Object prototype functions:

  • Object.prototype.hasOwnProperty #41
  • Object.prototype.isPrototypeOf #47
  • Object.prototype.propertyIsEnumerable #99
  • Object.prototype.toLocaleString #40
  • Object.prototype.toString
  • Object.prototype.valueOf

native callback with object gc

I'm adding this issue to discuss in open so may help others to understand and join (to the issues)

Codes can be efficient if some native function is called when JS Object is garbage collected so that some block of memory linked to that Object can be freed. Something like MakeWeak in V8.

API something like this;

typedef bool (*jerry_object_free_callback_t) (const jerry_api_object_t* obj);
bool jerry_api_set_objectfreecb(jerryt_api_object_t* obj, jerry_object_free_callback_t handler_p);

Math for embed devices

NuttX doesn't provide libm and have link problem.
fabs, acos, asin, atan, atan2, ceil, cos, exp, floor, log, pow, sin, sqrt and tan are undefined.
I'm posting this issue for discussion.

Byte code snap-shot to save runtime heap

IoT.js scripts are growing as development goes on and at the same time, it uses more Jerry heap space.
As of today, IoT.js built-in scripts consume about 64KB memory still more to go. If there is a way to save the heap memory it can give more to IoT.js application.
The idea is like V8's snap-shot;

  1. run Jerry with IoT.js built-in scripts
  2. make Jerry drop byte codes and Literals in to binary
  3. convert that binary to C source so that they exist in .text area (in ROM for embedded devices)
  4. build IoT.js
  5. when IoT.js is executed give snap-shot .text area memory to Jerry

Please add comments about how to make this possible and huddles to overcome.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.