Merge branch 'master' into geppetto
This commit is contained in:
@@ -0,0 +1,30 @@
|
|||||||
|
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
var count = 10000000;
|
||||||
|
var x = 7;
|
||||||
|
var y = 3;
|
||||||
|
|
||||||
|
var tmp1;
|
||||||
|
var tmp2;
|
||||||
|
var tmp3;
|
||||||
|
var tmp4;
|
||||||
|
|
||||||
|
for (var i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
tmp1 = x * x;
|
||||||
|
tmp2 = y * y;
|
||||||
|
tmp3 = tmp1 * tmp1;
|
||||||
|
tmp4 = tmp2 * tmp2;
|
||||||
|
}
|
||||||
+107
-12
@@ -16,20 +16,115 @@
|
|||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
|
||||||
static const char* generated_source = ""
|
static const char* generated_source = ""
|
||||||
"var count = 10000;\n"
|
"var tmp, a, b = 1, c = 2, d, e = 3, g = 4;\n"
|
||||||
"var x = 7;\n"
|
|
||||||
"var y = 3;\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
"var tmp1;\n"
|
"var count = 1000;\n"
|
||||||
"var tmp2;\n"
|
|
||||||
"var tmp3;\n"
|
|
||||||
"var tmp4;\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
"for (var i = 0; i < count; i++)\n"
|
"tmp = b * c;\n"
|
||||||
|
"a = tmp + g;\n"
|
||||||
|
"d = tmp * e + a;\n"
|
||||||
|
"\n"
|
||||||
|
"var waitTime = 600000;\n"
|
||||||
|
"var numOfIterations = 10;\n"
|
||||||
|
"\n"
|
||||||
|
"while (1)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
"tmp1 = x * x;\n"
|
"for (var j = 0; j < numOfIterations; j += 1)\n"
|
||||||
"tmp2 = y * y;\n"
|
"{\n"
|
||||||
"tmp3 = tmp1 * tmp1;\n"
|
"LEDOn(12);\n"
|
||||||
"tmp4 = tmp2 * tmp2;\n"
|
"LEDOn(13);\n"
|
||||||
|
"LEDOn(14);\n"
|
||||||
|
"LEDOn(15);\n"
|
||||||
|
"wait(waitTime * 2);\n"
|
||||||
|
"LEDOff(12);\n"
|
||||||
|
"LEDOff(13);\n"
|
||||||
|
"LEDOff(14);\n"
|
||||||
|
"LEDOff(15);\n"
|
||||||
|
"wait(waitTime * 2);\n"
|
||||||
|
"}\n"
|
||||||
|
"\n"
|
||||||
|
"for (var j = 0; j < numOfIterations; j += 1)\n"
|
||||||
|
"{\n"
|
||||||
|
"LEDOn(12);\n"
|
||||||
|
"wait(waitTime);\n"
|
||||||
|
"LEDOff(12);\n"
|
||||||
|
"wait(waitTime);\n"
|
||||||
|
"LEDOn(13);\n"
|
||||||
|
"wait(waitTime);\n"
|
||||||
|
"LEDOff(13);\n"
|
||||||
|
"wait(waitTime);\n"
|
||||||
|
"LEDOn(14);\n"
|
||||||
|
"wait(waitTime);\n"
|
||||||
|
"LEDOff(14);\n"
|
||||||
|
"wait(waitTime);\n"
|
||||||
|
"LEDOn(15);\n"
|
||||||
|
"wait(waitTime);\n"
|
||||||
|
"LEDOff(15);\n"
|
||||||
|
"wait(waitTime);\n"
|
||||||
|
"}\n"
|
||||||
|
"\n"
|
||||||
|
"for (var j = 0; j < numOfIterations; j += 1)\n"
|
||||||
|
"{\n"
|
||||||
|
"LEDOn(12);\n"
|
||||||
|
"wait(waitTime);\n"
|
||||||
|
"LEDOff(12);\n"
|
||||||
|
"LEDOn(13);\n"
|
||||||
|
"wait(waitTime);\n"
|
||||||
|
"LEDOff(13);\n"
|
||||||
|
"LEDOn(14);\n"
|
||||||
|
"wait(waitTime);\n"
|
||||||
|
"LEDOff(14);\n"
|
||||||
|
"LEDOn(15);\n"
|
||||||
|
"wait(waitTime);\n"
|
||||||
|
"LEDOff(15);\n"
|
||||||
|
"}\n"
|
||||||
|
"\n"
|
||||||
|
"for (var j = 0; j < numOfIterations; j += 1)\n"
|
||||||
|
"{\n"
|
||||||
|
"LEDOn(12);\n"
|
||||||
|
"wait(waitTime / 2);\n"
|
||||||
|
"LEDOff(12);\n"
|
||||||
|
"LEDOn(13);\n"
|
||||||
|
"wait(waitTime / 2);\n"
|
||||||
|
"LEDOff(13);\n"
|
||||||
|
"LEDOn(14);\n"
|
||||||
|
"wait(waitTime / 2);\n"
|
||||||
|
"LEDOff(14);\n"
|
||||||
|
"LEDOn(15);\n"
|
||||||
|
"wait(waitTime / 2);\n"
|
||||||
|
"LEDOff(15);\n"
|
||||||
|
"}\n"
|
||||||
|
"\n"
|
||||||
|
"for (var j = 0; j < numOfIterations; j += 1)\n"
|
||||||
|
"{\n"
|
||||||
|
"LEDOn(12);\n"
|
||||||
|
"wait(waitTime / 3);\n"
|
||||||
|
"LEDOff(12);\n"
|
||||||
|
"LEDOn(13);\n"
|
||||||
|
"wait(waitTime / 3);\n"
|
||||||
|
"LEDOff(13);\n"
|
||||||
|
"LEDOn(14);\n"
|
||||||
|
"wait(waitTime / 3);\n"
|
||||||
|
"LEDOff(14);\n"
|
||||||
|
"LEDOn(15);\n"
|
||||||
|
"wait(waitTime / 3);\n"
|
||||||
|
"LEDOff(15);\n"
|
||||||
|
"}\n"
|
||||||
|
"\n"
|
||||||
|
"for (var j = 0; j < numOfIterations; j += 1)\n"
|
||||||
|
"{\n"
|
||||||
|
"LEDOn(12);\n"
|
||||||
|
"wait(waitTime / 6);\n"
|
||||||
|
"LEDOff(12);\n"
|
||||||
|
"LEDOn(13);\n"
|
||||||
|
"wait(waitTime / 6);\n"
|
||||||
|
"LEDOff(13);\n"
|
||||||
|
"LEDOn(14);\n"
|
||||||
|
"wait(waitTime / 6);\n"
|
||||||
|
"LEDOff(14);\n"
|
||||||
|
"LEDOn(15);\n"
|
||||||
|
"wait(waitTime / 6);\n"
|
||||||
|
"LEDOff(15);\n"
|
||||||
|
"}\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -18,8 +18,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ecma-exceptions.h"
|
#include "ecma-exceptions.h"
|
||||||
|
#include "ecma-gc.h"
|
||||||
|
#include "ecma-global-object.h"
|
||||||
#include "ecma-helpers.h"
|
#include "ecma-helpers.h"
|
||||||
#include "ecma-lex-env.h"
|
#include "ecma-lex-env.h"
|
||||||
|
#include "ecma-objects-properties.h"
|
||||||
#include "ecma-operations.h"
|
#include "ecma-operations.h"
|
||||||
|
|
||||||
/** \addtogroup ecma ---TODO---
|
/** \addtogroup ecma ---TODO---
|
||||||
@@ -135,13 +138,19 @@ ecma_op_put_value(ecma_reference_t ref, /**< ECMA-reference */
|
|||||||
return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_REFERENCE));
|
return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_REFERENCE));
|
||||||
} else // PutValue_3.b
|
} else // PutValue_3.b
|
||||||
{
|
{
|
||||||
/*
|
ecma_object_t *global_object_p = ecma_get_global_object();
|
||||||
ecma_object_t *global_object_p = ecma_GetGlobalObject();
|
|
||||||
|
|
||||||
return global_object_p->[[Put]]( ref.referenced_name_p, value, false);
|
ecma_completion_value_t completion = ecma_op_object_put( global_object_p,
|
||||||
*/
|
ref.referenced_name_p,
|
||||||
|
value,
|
||||||
|
false);
|
||||||
|
|
||||||
JERRY_UNIMPLEMENTED();
|
ecma_deref_object( global_object_p);
|
||||||
|
|
||||||
|
JERRY_ASSERT( ecma_is_completion_value_normal_true( completion)
|
||||||
|
|| ecma_is_completion_value_normal_false( completion) );
|
||||||
|
|
||||||
|
return ecma_make_empty_completion_value();
|
||||||
}
|
}
|
||||||
} else if ( is_property_reference ) // PutValue_4
|
} else if ( is_property_reference ) // PutValue_4
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
#include "ecma-gc.h"
|
||||||
#include "ecma-globals.h"
|
#include "ecma-globals.h"
|
||||||
#include "ecma-global-object.h"
|
#include "ecma-global-object.h"
|
||||||
#include "ecma-helpers.h"
|
#include "ecma-helpers.h"
|
||||||
@@ -26,6 +27,27 @@
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global object
|
||||||
|
*/
|
||||||
|
static ecma_object_t* ecma_global_object_p = NULL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Global object
|
||||||
|
*
|
||||||
|
* @return pointer to the Global object
|
||||||
|
* caller should free the reference by calling ecma_deref_object
|
||||||
|
*/
|
||||||
|
ecma_object_t*
|
||||||
|
ecma_get_global_object( void)
|
||||||
|
{
|
||||||
|
JERRY_ASSERT( ecma_global_object_p != NULL );
|
||||||
|
|
||||||
|
ecma_ref_object( ecma_global_object_p);
|
||||||
|
|
||||||
|
return ecma_global_object_p;
|
||||||
|
} /* ecma_get_global_object */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Global Object construction routine.
|
* The Global Object construction routine.
|
||||||
*
|
*
|
||||||
@@ -36,6 +58,8 @@
|
|||||||
ecma_object_t*
|
ecma_object_t*
|
||||||
ecma_op_create_global_object( void)
|
ecma_op_create_global_object( void)
|
||||||
{
|
{
|
||||||
|
JERRY_ASSERT( ecma_global_object_p == NULL );
|
||||||
|
|
||||||
ecma_object_t *glob_obj_p = ecma_create_object( NULL, true, ECMA_OBJECT_TYPE_GENERAL);
|
ecma_object_t *glob_obj_p = ecma_create_object( NULL, true, ECMA_OBJECT_TYPE_GENERAL);
|
||||||
|
|
||||||
ecma_property_t *undefined_prop_p = ecma_create_named_data_property( glob_obj_p,
|
ecma_property_t *undefined_prop_p = ecma_create_named_data_property( glob_obj_p,
|
||||||
@@ -47,6 +71,9 @@ ecma_op_create_global_object( void)
|
|||||||
|
|
||||||
TODO( /* Define NaN, Infinity, eval, parseInt, parseFloat, isNaN, isFinite properties */ );
|
TODO( /* Define NaN, Infinity, eval, parseInt, parseFloat, isNaN, isFinite properties */ );
|
||||||
|
|
||||||
|
ecma_ref_object( glob_obj_p);
|
||||||
|
ecma_global_object_p = glob_obj_p;
|
||||||
|
|
||||||
return glob_obj_p;
|
return glob_obj_p;
|
||||||
} /* ecma_op_create_global_object */
|
} /* ecma_op_create_global_object */
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
extern ecma_object_t* ecma_get_global_object(void);
|
||||||
extern ecma_object_t* ecma_op_create_global_object( void);
|
extern ecma_object_t* ecma_op_create_global_object( void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -212,7 +212,8 @@ ecma_op_object_put( ecma_object_t *obj_p, /**< the object */
|
|||||||
ecma_property_t *own_desc_p = ecma_op_object_get_own_property( obj_p, property_name_p);
|
ecma_property_t *own_desc_p = ecma_op_object_get_own_property( obj_p, property_name_p);
|
||||||
|
|
||||||
// 3.
|
// 3.
|
||||||
if ( own_desc_p->type == ECMA_PROPERTY_NAMEDDATA )
|
if ( own_desc_p != NULL
|
||||||
|
&& own_desc_p->type == ECMA_PROPERTY_NAMEDDATA )
|
||||||
{
|
{
|
||||||
// a.
|
// a.
|
||||||
ecma_property_descriptor_t value_desc = ecma_make_empty_property_descriptor();
|
ecma_property_descriptor_t value_desc = ecma_make_empty_property_descriptor();
|
||||||
@@ -232,7 +233,8 @@ ecma_op_object_put( ecma_object_t *obj_p, /**< the object */
|
|||||||
ecma_property_t *desc_p = ecma_op_object_get_property( obj_p, property_name_p);
|
ecma_property_t *desc_p = ecma_op_object_get_property( obj_p, property_name_p);
|
||||||
|
|
||||||
// 5.
|
// 5.
|
||||||
if ( desc_p->type == ECMA_PROPERTY_NAMEDACCESSOR )
|
if ( desc_p != NULL
|
||||||
|
&& desc_p->type == ECMA_PROPERTY_NAMEDACCESSOR )
|
||||||
{
|
{
|
||||||
// a.
|
// a.
|
||||||
ecma_object_t *setter_p = ecma_get_pointer( desc_p->u.named_accessor_property.set_p);
|
ecma_object_t *setter_p = ecma_get_pointer( desc_p->u.named_accessor_property.set_p);
|
||||||
|
|||||||
+15
-7
@@ -130,12 +130,17 @@ read_sources (const char *script_file_names[],
|
|||||||
|
|
||||||
__rewind( file);
|
__rewind( file);
|
||||||
|
|
||||||
const size_t source_size = (size_t)script_len;
|
const size_t current_source_size = (size_t)script_len;
|
||||||
size_t bytes_read = 0;
|
|
||||||
|
|
||||||
while ( bytes_read < source_size )
|
if ( source_buffer_tail + current_source_size >= source_buffer + sizeof(source_buffer) )
|
||||||
{
|
{
|
||||||
bytes_read += __fread( source_buffer_tail, 1, source_size, file);
|
jerry_exit (ERR_MEMORY);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t bytes_read = 0;
|
||||||
|
while ( bytes_read < current_source_size )
|
||||||
|
{
|
||||||
|
bytes_read += __fread( source_buffer_tail + bytes_read, sizeof(uint8_t), current_source_size - bytes_read, file);
|
||||||
|
|
||||||
if ( __ferror( file) != 0 )
|
if ( __ferror( file) != 0 )
|
||||||
{
|
{
|
||||||
@@ -145,11 +150,14 @@ read_sources (const char *script_file_names[],
|
|||||||
|
|
||||||
__fclose( file);
|
__fclose( file);
|
||||||
|
|
||||||
source_buffer_tail += source_size;
|
source_buffer_tail += current_source_size;
|
||||||
|
|
||||||
*out_source_size_p += source_size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const size_t source_size = (size_t) (source_buffer_tail - source_buffer);
|
||||||
|
JERRY_ASSERT( source_size < sizeof(source_buffer) );
|
||||||
|
|
||||||
|
*out_source_size_p = source_size;
|
||||||
|
|
||||||
return (const char*)source_buffer;
|
return (const char*)source_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
var a = 1;
|
||||||
|
var b = 2;
|
||||||
|
|
||||||
|
assertEquals(a+b, 3);
|
||||||
|
assertEquals(b+a, 3);
|
||||||
+5
-5
@@ -14,12 +14,12 @@
|
|||||||
|
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo "#include \"globals.h\"" > "generated.h"
|
echo "#include \"globals.h\"" > $2
|
||||||
echo "" >> "generated.h"
|
echo "" >> $2
|
||||||
echo "static const char* generated_source = \"\"" >> "generated.h"
|
echo "static const char* generated_source = \"\"" >> $2
|
||||||
while read line
|
while read line
|
||||||
do
|
do
|
||||||
echo "\"$line\n\"" >> "generated.h"
|
echo "\"$line\n\"" >> $2
|
||||||
done < $1
|
done < $1
|
||||||
echo ";" >> "generated.h"
|
echo ";" >> $2
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user